This commit is contained in:
2026-06-13 07:33:46 +08:00
parent e2da13bc5c
commit 24017e7454
40 changed files with 3135 additions and 108 deletions
+48
View File
@@ -0,0 +1,48 @@
"""朋友圈相关 Schema"""
from datetime import datetime
from pydantic import BaseModel, Field
class MomentCreate(BaseModel):
content: str = Field(..., min_length=1, max_length=1000)
images: list[str] | None = Field(None, max_length=9)
visibility: str = Field("friends", pattern="^(public|friends|private)$")
class MomentRead(BaseModel):
id: str
user_id: str
username: str
nickname: str | None = None
avatar_url: str | None = None
content: str
images: list[str] = []
visibility: str
like_count: int = 0
is_liked: bool = False
comment_count: int = 0
created_at: datetime
model_config = {"from_attributes": True}
class MomentCommentCreate(BaseModel):
content: str = Field(..., min_length=1, max_length=500)
reply_to_id: str | None = None
class MomentCommentRead(BaseModel):
id: str
moment_id: str
user_id: str
username: str
nickname: str | None = None
avatar_url: str | None = None
content: str
reply_to_id: str | None = None
reply_to_username: str | None = None
created_at: datetime
model_config = {"from_attributes": True}