claude_sms_test
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# schemas/teacher_schema.py
|
||||
# 教师信息模块的 Pydantic 模式
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class TeacherBase(BaseModel):
|
||||
"""教师公共字段"""
|
||||
name: str = Field(..., max_length=20, description="姓名")
|
||||
phone: str = Field(..., max_length=20, description="电话(唯一)")
|
||||
type: str = Field(..., max_length=20, description="教师职位")
|
||||
|
||||
|
||||
class TeacherCreate(TeacherBase):
|
||||
"""新增教师时,id 必填"""
|
||||
id: str = Field(..., max_length=15, description="教师编号(主键)")
|
||||
|
||||
|
||||
class TeacherUpdate(BaseModel):
|
||||
"""更新教师信息:仅更新传入的字段"""
|
||||
name: Optional[str] = Field(default=None, max_length=20, description="姓名")
|
||||
phone: Optional[str] = Field(default=None, max_length=20, description="电话(唯一)")
|
||||
type: Optional[str] = Field(default=None, max_length=20, description="教师职位")
|
||||
|
||||
|
||||
class TeacherOut(TeacherBase):
|
||||
"""教师响应模型(含 id 与软删除标记)"""
|
||||
id: str
|
||||
is_deleted: int
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
Reference in New Issue
Block a user