27 lines
592 B
Python
27 lines
592 B
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
from app.schemas.user import UserInfo
|
|
|
|
|
|
class CommentCreate(BaseModel):
|
|
content: str = Field(..., min_length=1, max_length=500)
|
|
parent_id: int | None = None
|
|
|
|
|
|
class CommentOut(BaseModel):
|
|
id: int
|
|
spot_id: int
|
|
user: UserInfo | None = None
|
|
parent_id: int | None = None
|
|
content: str
|
|
created_at: datetime | None = None
|
|
replies: list["CommentOut"] = []
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class ReportCreate(BaseModel):
|
|
reason: str = Field(..., min_length=1, max_length=500)
|