Support-BOT
This commit is contained in:
0
app/schemas/__init__.py
Normal file
0
app/schemas/__init__.py
Normal file
24
app/schemas/message.py
Normal file
24
app/schemas/message.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class MessageBaseScheme(BaseModel):
|
||||
telegram_user_id: int
|
||||
text: Optional[str]
|
||||
attachments: Optional[bool]
|
||||
answer_to_user: Optional[int]
|
||||
|
||||
|
||||
class MessageCreateScheme(MessageBaseScheme):
|
||||
pass
|
||||
|
||||
|
||||
class MessageFromDBScheme(MessageBaseScheme):
|
||||
id: int
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
27
app/schemas/user.py
Normal file
27
app/schemas/user.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class UserBaseScheme(BaseModel):
|
||||
telegram_id: int
|
||||
telegram_username: Optional[str] = Field(None, max_length=100)
|
||||
is_banned: Optional[bool]
|
||||
first_name: Optional[str] = Field(None, max_length=100)
|
||||
last_name: Optional[str] = Field(None, max_length=100)
|
||||
is_admin: Optional[bool] = Field(None)
|
||||
|
||||
|
||||
class UserCreateScheme(UserBaseScheme):
|
||||
pass
|
||||
|
||||
|
||||
class UserFromDBScheme(UserBaseScheme):
|
||||
id: int
|
||||
is_banned: bool
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
Reference in New Issue
Block a user