26 lines
635 B
Python
26 lines
635 B
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
|
|
class PersonImageBase(BaseModel):
|
|
"""人物形象基础模型"""
|
|
image_url: str
|
|
is_default: bool = False
|
|
|
|
class PersonImageCreate(PersonImageBase):
|
|
"""创建人物形象请求模型"""
|
|
pass
|
|
|
|
class PersonImageUpdate(PersonImageBase):
|
|
"""更新人物形象请求模型"""
|
|
image_url: Optional[str] = None
|
|
is_default: Optional[bool] = None
|
|
|
|
class PersonImage(PersonImageBase):
|
|
"""人物形象响应模型"""
|
|
id: int
|
|
user_id: int
|
|
create_time: datetime
|
|
|
|
class Config:
|
|
from_attributes = True |