Files
stu/schema/score_request.py
T

29 lines
1.2 KiB
Python
Raw Normal View History

2026-09-22 17:36:49 +08:00
from pydantic import BaseModel, Field
from datetime import date
from typing import Optional
class ScoreRequest(BaseModel):
student_id: str = Field(...,min_length=1, max_length=20,description="学号")
course_id: str = Field(..., min_length=1, max_length=20,description="课程编号")
teacher_id: str = Field(..., min_length=1, max_length=20,description="教师编号")
exam_order: int = Field(1,ge=1, description="考核序次(第几次考核)")
exam_type: int = Field(...,ge=1, le=4,description="考试类型:1=期中,2=期末,3=月考,4=模拟")
score: Optional[float] = Field(None,ge=0, le=100,description="分数 0~100,缺考填 null")
exam_date: date = Field(..., description="考试日期(YYYY-MM-DD)")
remark: Optional[str] = Field(None, description="备注,例如:缺考、缓考")
class ScoreUpdateRequest(BaseModel):
score: Optional[float] = Field(
None,
ge=0, le=100,
description="新分数 0~100"
)
remark: Optional[str] = Field(None, description="新备注")
class ScoreResponse(BaseModel):
code: int = 200
detail: str = 'OK'
totals: int = 0
data: str | dict | tuple | list