Files
SharedClassManager/backend/schemas/admin.py
2026-04-16 07:55:46 +08:00

88 lines
2.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ===========================================
# 班级操行分管理系统 - 后端服务
#
# 开发者: 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
from datetime import date, datetime
class AddPointsRequest(BaseModel):
"""加减分请求"""
student_ids: List[int] = Field(..., description="学生ID列表")
points_change: int = Field(..., description="分数变动")
reason: str = Field(..., min_length=1, max_length=255, description="原因")
class AddPointsResponse(BaseModel):
"""加减分响应"""
success_count: int
fail_count: int
details: List[dict]
class RevokeRequest(BaseModel):
"""撤销请求"""
record_id: int = Field(..., description="记录ID")
class ImportStudentsRequest(BaseModel):
"""导入学生请求"""
students: List[dict] = Field(..., description="学生列表")
class ImportResult(BaseModel):
"""导入结果"""
total: int
success: int
failed: int
errors: List[str]
class AddAdminRequest(BaseModel):
"""添加管理员请求"""
username: str = Field(..., min_length=1, max_length=50, 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科代表需要")
class AddAdminResponse(BaseModel):
"""添加管理员响应"""
success: bool
username: str
password: Optional[str] = None
message: str
class UpdateHomeworkStatusRequest(BaseModel):
"""更新作业状态请求"""
submission_id: int
status: str
comments: Optional[str] = None
apply_deduction: bool = False
class AddStudentRequest(BaseModel):
"""新增学生请求"""
student_no: str = Field(..., min_length=1, max_length=20, description="学号")
name: str = Field(..., min_length=1, max_length=50, description="姓名")
parent_phone: Optional[str] = Field(None, max_length=11, description="家长手机号")
class AddAttendanceRequest(BaseModel):
"""添加考勤请求"""
student_id: int
date: date
status: str
reason: Optional[str] = None
apply_deduction: bool = True
custom_deduction: Optional[int] = Field(default=None, gt=0, description="自定义扣分值")