init
This commit is contained in:
35
app/schemas.py
Normal file
35
app/schemas.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import List, Optional
|
||||
from datetime import datetime
|
||||
|
||||
class MessageBase(BaseModel):
|
||||
role: str
|
||||
content: str
|
||||
|
||||
class MessageOut(MessageBase):
|
||||
id: int
|
||||
created_at: datetime
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class ChatBase(BaseModel):
|
||||
title: str
|
||||
|
||||
class ChatOut(ChatBase):
|
||||
id: int
|
||||
messages: List[MessageOut] = []
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class UserOut(BaseModel):
|
||||
id: int
|
||||
telegram_id: str
|
||||
username: Optional[str]
|
||||
chats: List[ChatOut] = []
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
Reference in New Issue
Block a user