37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
# import data
|
|
from h11 import Data
|
|
from pydantic import BaseModel, Field, ConfigDict,EmailStr
|
|
from datetime import datetime, date
|
|
from typing import Optional
|
|
|
|
# ---------- 请求模型 ----------
|
|
class ClsMgmtCreate(BaseModel):
|
|
# id: str = Field(..., min_length=3, max_length=50)
|
|
cls_start_date: date=Field(...,description="开课时间,年-月-日")
|
|
head_tea_id: str=Field(...,description="班主任工号,例:t001")
|
|
lecturer_id: str = Field(..., description="班主任工号,例:t001")
|
|
|
|
class ClsMgmtUpdate(BaseModel):
|
|
# id: str = Field(..., min_length=3, max_length=50)
|
|
# cls_start_date: Data=Field(...,description="开课时间,年-月-日")
|
|
head_tea_id: str=Field(...,description="班主任工号,例:t001")
|
|
lecturer_id: str = Field(..., description="班主任工号,例:t001")
|
|
|
|
# ---------- 响应模型 ----------
|
|
class ClsMgmtResponse(BaseModel):
|
|
id: str
|
|
cls_start_date: date
|
|
head_tea_id: str
|
|
lecturer_id: str
|
|
class Config:
|
|
from_attributes = True # 支持 ORM 对象转换
|
|
|
|
|
|
|
|
# model_config = ConfigDict(from_attributes=True)
|
|
# class Config:
|
|
# orm_mode = True
|
|
# created_at: datetime
|
|
# updated_at: Optional[datetime]
|
|
#
|