test四轮完成的版本,并入了刘盼的老师模块
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
from pydantic import BaseModel, Field, ConfigDict
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
# ---------- 请求模型 ----------
|
||||
class TeacherCreate(BaseModel):
|
||||
t_no: Optional[str] = Field(None, max_length=20, description="老师编号,不传则自动生成")
|
||||
t_name: str = Field(..., max_length=50, description="老师姓名")
|
||||
t_phone: Optional[str] = Field(None, max_length=20, description="电话")
|
||||
t_email: Optional[str] = Field(None, max_length=20, description="邮箱")
|
||||
class_id: int = Field(..., description="班级ID")
|
||||
role: str = Field(..., max_length=50, description="角色")
|
||||
|
||||
class TeacherUpdate(BaseModel):
|
||||
t_no: Optional[str] = Field(None, max_length=20)
|
||||
t_name: Optional[str] = Field(None, max_length=50)
|
||||
t_phone: Optional[str] = Field(None, max_length=20)
|
||||
t_email: Optional[str] = Field(None, max_length=20)
|
||||
class_id: Optional[int] = None
|
||||
role: Optional[str] = Field(None, max_length=50)
|
||||
|
||||
# ---------- 响应模型 ----------
|
||||
class TeacherResponse(BaseModel):
|
||||
t_id: int
|
||||
t_no: str
|
||||
t_name: str
|
||||
class_id: int
|
||||
role: str
|
||||
t_phone: Optional[str]
|
||||
t_email: Optional[str]
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user