Files
lms-it-oms/backend/app/schemas.py

33 lines
893 B
Python

"""Pydantic-схемы для API."""
from pydantic import BaseModel, Field
class StartRequest(BaseModel):
"""Запрос на начало обучения."""
fio: str = Field(..., min_length=1, max_length=500, description="ФИО сотрудника")
class StartResponse(BaseModel):
"""Ответ после регистрации начала обучения."""
participant_id: str
fio: str
class CompleteRequest(BaseModel):
"""Запрос на фиксацию результата теста."""
participant_id: str = Field(..., min_length=1)
score: int = Field(..., ge=0)
total_questions: int = Field(..., gt=0)
percent: float = Field(..., ge=0, le=100)
passed: bool
class CompleteResponse(BaseModel):
"""Ответ после сохранения результата."""
participant_id: str
saved: bool = True