Files
1/scheme/wl_teacher_scheme.py
T

35 lines
1.2 KiB
Python
Raw Normal View History

2026-09-21 20:16:09 +08:00
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)