15 lines
548 B
Python
15 lines
548 B
Python
from pydantic import BaseModel, Field
|
|||
|
|
from typing import Optional
|
||
|
|
|
||
|
|
class TeacherBase(BaseModel):
|
||
|
|
teacher_no: str = Field(..., max_length=50, description="教师编号")
|
||
|
|
name: str = Field(..., max_length=50, description="教师姓名")
|
||
|
|
phone: str = Field(..., max_length=50, description="手机号")
|
||
|
|
|
||
|
|
class TeacherCreate(TeacherBase):
|
||
|
|
pass
|
||
|
|
|
||
|
|
class TeacherUpdate(BaseModel):
|
||
|
|
name: Optional[str] = Field(None, max_length=50, description="教师姓名")
|
||
|
|
phone: Optional[str] = Field(None, max_length=50, description="手机号")
|