43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
# ===========================================
|
|
# 班级操行分管理系统 - 后端服务
|
|
#
|
|
# 开发者: Canglan
|
|
# 联系方式: admin@sea-studio.top
|
|
# 版权归属: Sea Network Technology Studio
|
|
# 许可证: MIT License
|
|
#
|
|
# 版权所有 © Sea Network Technology Studio
|
|
# ===========================================
|
|
|
|
from pydantic import BaseModel, Field
|
|
from typing import Optional, List
|
|
|
|
|
|
class SubjectInfo(BaseModel):
|
|
"""科目信息"""
|
|
subject_id: int
|
|
subject_name: str
|
|
subject_code: Optional[str] = None
|
|
is_active: bool
|
|
sort_order: int
|
|
|
|
|
|
class CreateSubjectRequest(BaseModel):
|
|
"""创建科目请求"""
|
|
subject_name: str = Field(..., min_length=1, max_length=50, description="科目名称")
|
|
subject_code: Optional[str] = Field(None, max_length=20, description="科目代码")
|
|
sort_order: int = Field(0, description="排序序号")
|
|
|
|
|
|
class UpdateSubjectRequest(BaseModel):
|
|
"""更新科目请求"""
|
|
subject_name: Optional[str] = Field(None, max_length=50, description="科目名称")
|
|
subject_code: Optional[str] = Field(None, max_length=20, description="科目代码")
|
|
is_active: Optional[bool] = Field(None, description="是否启用")
|
|
sort_order: Optional[int] = Field(None, description="排序序号")
|
|
|
|
|
|
class SubjectListResponse(BaseModel):
|
|
"""科目列表响应"""
|
|
subjects: List[SubjectInfo]
|
|
total: int |