13 lines
401 B
Python
13 lines
401 B
Python
from datetime import datetime
|
|||
|
|
from pydantic import BaseModel,Field
|
||
|
|
#引入Pydantic数据校验。
|
||
|
|
class AdvisorIn(BaseModel):
|
||
|
|
advisor_id: int=Field(...,ge=1,description="顾问ID")
|
||
|
|
advisor_name: str=Field(...,min_length=2,max_length=8,description="姓名为2~8个字符")
|
||
|
|
|
||
|
|
class AdvisorOut(BaseModel):
|
||
|
|
advisor_id: int
|
||
|
|
advisor_name: str
|
||
|
|
class Config:
|
||
|
|
from_attributes = True
|