32 lines
697 B
Python
32 lines
697 B
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class CommentCreate(BaseModel):
|
|
content: str = Field(min_length=1)
|
|
quote_comment_id: uuid.UUID | None = None
|
|
|
|
|
|
class CommentQuote(BaseModel):
|
|
id: uuid.UUID
|
|
content: str
|
|
created_by: uuid.UUID
|
|
created_at: datetime
|
|
is_deleted: bool = False
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class CommentRead(BaseModel):
|
|
id: uuid.UUID
|
|
content: str
|
|
created_by: uuid.UUID
|
|
created_at: datetime
|
|
quote_comment_id: uuid.UUID | None = None
|
|
quote: CommentQuote | None = None
|
|
is_deleted: bool = False
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|