Add Message schema

This commit is contained in:
Backend IM Bot 2025-03-26 08:09:17 +00:00
parent dd686ed103
commit fd7ba3a313

View File

@ -4,7 +4,7 @@ from uuid import UUID
class MessageBase(BaseModel):
sender_id: UUID = Field(..., description="ID of the message sender")
receiver_id: UUID = Field(..., description="ID of the message receiver")
recipient_id: UUID = Field(..., description="ID of the message recipient")
content: str = Field(..., min_length=1, description="Content of the message")
is_read: bool = Field(default=False, description="Message read status")
@ -13,7 +13,7 @@ class MessageCreate(MessageBase):
schema_extra = {
"example": {
"sender_id": "123e4567-e89b-12d3-a456-426614174000",
"receiver_id": "123e4567-e89b-12d3-a456-426614174001",
"recipient_id": "987fcdeb-51a2-43d7-9876-543210987654",
"content": "Hello, how are you?",
"is_read": False
}
@ -26,9 +26,9 @@ class Message(MessageBase):
orm_mode = True
schema_extra = {
"example": {
"id": "123e4567-e89b-12d3-a456-426614174002",
"id": "550e8400-e29b-41d4-a716-446655440000",
"sender_id": "123e4567-e89b-12d3-a456-426614174000",
"receiver_id": "123e4567-e89b-12d3-a456-426614174001",
"recipient_id": "987fcdeb-51a2-43d7-9876-543210987654",
"content": "Hello, how are you?",
"is_read": False
}