优化考勤记录
This commit is contained in:
@@ -16,8 +16,8 @@ from datetime import date, datetime
|
||||
|
||||
class AddPointsRequest(BaseModel):
|
||||
"""加减分请求"""
|
||||
student_ids: List[int] = Field(..., description="学生ID列表")
|
||||
points_change: int = Field(..., description="分数变动")
|
||||
student_ids: List[int] = Field(..., min_length=1, max_length=200, description="学生ID列表")
|
||||
points_change: int = Field(..., gt=-100, lt=100, description="分数变动")
|
||||
reason: str = Field(..., min_length=1, max_length=255, description="原因")
|
||||
|
||||
|
||||
@@ -48,11 +48,11 @@ class ImportResult(BaseModel):
|
||||
|
||||
class AddAdminRequest(BaseModel):
|
||||
"""添加管理员请求"""
|
||||
username: str = Field(..., min_length=1, max_length=50, description="登录账号")
|
||||
username: str = Field(..., min_length=2, max_length=50, pattern=r'^[a-zA-Z0-9_\u4e00-\u9fa]+$', description="登录账号")
|
||||
real_name: str = Field(..., min_length=1, max_length=50, description="真实姓名")
|
||||
password: Optional[str] = Field(None, description="密码(不填则自动生成)")
|
||||
role_type: str = Field(..., description="角色类型")
|
||||
subject_id: Optional[int] = Field(None, description="科目ID(科代表需要)")
|
||||
password: Optional[str] = Field(None, min_length=6, max_length=50, description="密码(不填则自动生成)")
|
||||
role_type: str = Field(..., pattern=r'^(班长|学习委员|考勤委员|劳动委员|志愿委员)$', description="角色类型")
|
||||
subject_id: Optional[int] = Field(None, gt=0, description="科目ID(科代表需要)")
|
||||
|
||||
|
||||
class AddAdminResponse(BaseModel):
|
||||
@@ -65,34 +65,35 @@ class AddAdminResponse(BaseModel):
|
||||
|
||||
class UpdateHomeworkStatusRequest(BaseModel):
|
||||
"""更新作业状态请求"""
|
||||
submission_id: int
|
||||
status: str
|
||||
comments: Optional[str] = None
|
||||
submission_id: int = Field(..., gt=0, description="提交记录ID")
|
||||
status: str = Field(..., pattern=r'^(submitted|not_submitted|late|excused)$', description="状态")
|
||||
comments: Optional[str] = Field(None, max_length=500, description="评语")
|
||||
apply_deduction: bool = False
|
||||
|
||||
|
||||
class AddStudentRequest(BaseModel):
|
||||
"""新增学生请求"""
|
||||
student_no: str = Field(..., min_length=1, max_length=20, description="学号")
|
||||
student_no: str = Field(..., min_length=1, max_length=20, pattern=r'^[a-zA-Z0-9]+$', description="学号")
|
||||
name: str = Field(..., min_length=1, max_length=50, description="姓名")
|
||||
parent_phone: Optional[str] = Field(None, max_length=11, description="家长手机号")
|
||||
parent_phone: Optional[str] = Field(None, max_length=11, pattern=r'^\d{0,11}$', description="家长手机号")
|
||||
|
||||
|
||||
class AddAttendanceRequest(BaseModel):
|
||||
"""添加考勤请求"""
|
||||
student_id: int
|
||||
student_id: int = Field(..., gt=0, description="学生ID")
|
||||
date: date
|
||||
status: str
|
||||
reason: Optional[str] = None
|
||||
slot: str = Field(default="morning", pattern=r'^(morning|afternoon|evening)$', description="时段")
|
||||
status: str = Field(..., pattern=r'^(present|absent|late|leave)$', description="考勤状态")
|
||||
reason: Optional[str] = Field(None, max_length=255, description="原因")
|
||||
apply_deduction: bool = True
|
||||
custom_deduction: Optional[int] = Field(default=None, gt=0, description="自定义扣分值")
|
||||
custom_deduction: Optional[int] = Field(default=None, gt=0, le=20, description="自定义扣分值")
|
||||
|
||||
|
||||
class UpdateAdminRequest(BaseModel):
|
||||
"""更新管理员请求"""
|
||||
user_id: int = Field(..., description="用户ID")
|
||||
user_id: int = Field(..., gt=0, description="用户ID")
|
||||
real_name: str = Field(..., min_length=1, max_length=50, description="真实姓名")
|
||||
role_type: str = Field(..., description="角色类型")
|
||||
role_type: str = Field(..., pattern=r'^(班长|学习委员|考勤委员|劳动委员|志愿委员)$', description="角色类型")
|
||||
|
||||
|
||||
class DeleteAdminRequest(BaseModel):
|
||||
@@ -108,4 +109,4 @@ class ResetPasswordRequest(BaseModel):
|
||||
class UpdateStudentRequest(BaseModel):
|
||||
"""更新学生请求"""
|
||||
name: Optional[str] = Field(None, min_length=1, max_length=50, description="姓名")
|
||||
parent_phone: Optional[str] = Field(None, max_length=20, description="家长手机号")
|
||||
parent_phone: Optional[str] = Field(None, max_length=11, pattern=r'^\d{0,11}$', description="家长手机号")
|
||||
Reference in New Issue
Block a user