Feature: серверная часть, ФИО и результаты теста в БД; правка ответа эскалация 80%
Made-with: Cursor
This commit is contained in:
32
backend/app/schemas.py
Normal file
32
backend/app/schemas.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user