24 lines
556 B
Python
24 lines
556 B
Python
from __future__ import annotations
|
|
from uuid import UUID
|
|
from pydantic import BaseModel, ConfigDict
|
|
from typing import Optional
|
|
|
|
class RoomCreate(BaseModel):
|
|
title: Optional[str] = None
|
|
participants: list[str] # user IDs
|
|
|
|
class RoomRead(BaseModel):
|
|
id: UUID
|
|
title: Optional[str] = None
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
class MessageCreate(BaseModel):
|
|
content: str
|
|
|
|
class MessageRead(BaseModel):
|
|
id: UUID
|
|
room_id: UUID
|
|
sender_id: UUID
|
|
content: str
|
|
model_config = ConfigDict(from_attributes=True)
|