add. 添加友情链接增删改查接口
This commit is contained in:
@@ -35,3 +35,37 @@ class FriendLinkCreateSchema(Schema):
|
||||
url: str
|
||||
order: int = 0
|
||||
is_active: bool = True
|
||||
|
||||
|
||||
# ================= 响应模式 (Output) =================
|
||||
class PictureLinkSchema(Schema):
|
||||
id: int
|
||||
name: str
|
||||
picture: str # 这里返回的是图片路径字符串
|
||||
url: str
|
||||
order: int
|
||||
is_active: bool
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
# 如果你的 Model 字段和 Schema 字段名一致,通常不需要 orm_mode
|
||||
# 但为了保险,或者如果你直接返回 Model 实例,建议开启
|
||||
from_attributes = True
|
||||
|
||||
|
||||
# ================= 请求模式 (Input) =================
|
||||
class PictureLinkCreateSchema(Schema):
|
||||
name: str
|
||||
picture: str
|
||||
url: str
|
||||
order: int = 0
|
||||
is_active: bool = True
|
||||
|
||||
|
||||
class PictureLinkUpdateSchema(Schema):
|
||||
name: Optional[str] = None
|
||||
picture: Optional[str] = None
|
||||
url: Optional[str] = None
|
||||
order: Optional[int] = None
|
||||
is_active: Optional[bool] = None
|
||||
|
||||
Reference in New Issue
Block a user