Spaces:
Sleeping
Sleeping
File size: 506 Bytes
ce673e5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | from pydantic import BaseModel, Field, ConfigDict
from datetime import datetime, timezone
from typing import Optional
import uuid
class Message(BaseModel):
model_config = ConfigDict(extra="ignore")
id: str = Field(default_factory=lambda: str(uuid.uuid4()))
sender_id: str
receiver_id: str
content: str
read: bool = False
timestamp: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
class SendMessageRequest(BaseModel):
receiver_id: str
content: str
|