first commit
This commit is contained in:
33
app/chats/schemas.py
Normal file
33
app/chats/schemas.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.chats.models import ChatMemberRole, ChatType
|
||||
|
||||
|
||||
class ChatRead(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
type: ChatType
|
||||
title: str | None = None
|
||||
created_at: datetime
|
||||
|
||||
|
||||
class ChatMemberRead(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
user_id: int
|
||||
role: ChatMemberRole
|
||||
joined_at: datetime
|
||||
|
||||
|
||||
class ChatDetailRead(ChatRead):
|
||||
members: list[ChatMemberRead]
|
||||
|
||||
|
||||
class ChatCreateRequest(BaseModel):
|
||||
type: ChatType
|
||||
title: str | None = Field(default=None, max_length=255)
|
||||
member_ids: list[int] = Field(default_factory=list)
|
||||
Reference in New Issue
Block a user