人脸
This commit is contained in:
@ -6,28 +6,25 @@ from pydantic import BaseModel, Field
|
||||
# 请求模型(前端传参校验)
|
||||
# ------------------------------
|
||||
class FaceCreateRequest(BaseModel):
|
||||
"""创建人脸记录请求模型"""
|
||||
id: int = Field(..., description="主键ID")
|
||||
name: str = Field(None, max_length=255, description="名称")
|
||||
eigenvalue: str = Field(None, max_length=255, description="特征")
|
||||
"""创建人脸记录请求模型(无需ID,由数据库自增)"""
|
||||
name: str = Field(None, max_length=255, description="名称(可选,最长255字符)")
|
||||
|
||||
|
||||
class FaceUpdateRequest(BaseModel):
|
||||
"""更新人脸记录请求模型"""
|
||||
"""更新人脸记录请求模型(不变)"""
|
||||
name: str = Field(None, max_length=255, description="名称")
|
||||
eigenvalue: str = Field(None, max_length=255, description="特征")
|
||||
eigenvalue: str = Field(None, max_length=255, description="特征(文件处理后可更新)")
|
||||
|
||||
|
||||
# ------------------------------
|
||||
# 响应模型(后端返回数据)
|
||||
# ------------------------------
|
||||
class FaceResponse(BaseModel):
|
||||
"""人脸记录响应模型"""
|
||||
id: int = Field(..., description="主键ID")
|
||||
"""人脸记录响应模型(仍包含ID,由数据库生成后返回)"""
|
||||
id: int = Field(..., description="主键ID(数据库自增)")
|
||||
name: str = Field(None, description="名称")
|
||||
eigenvalue: str = Field(None, description="特征")
|
||||
eigenvalue: str = Field(None, description="特征(暂为None)")
|
||||
created_at: datetime = Field(..., description="记录创建时间")
|
||||
updated_at: datetime = Field(..., description="记录更新时间")
|
||||
|
||||
# 支持从数据库查询结果转换
|
||||
model_config = {"from_attributes": True}
|
||||
model_config = {"from_attributes": True}
|
Reference in New Issue
Block a user