add algam
This commit is contained in:
@@ -120,4 +120,89 @@ class PaginatedResponse(BaseModel):
|
||||
limit: int
|
||||
offset: int
|
||||
has_next: bool
|
||||
has_prev: bool
|
||||
has_prev: bool
|
||||
|
||||
# Схемы для работы с тестами
|
||||
|
||||
class TestCategoryCreate(BaseModel):
|
||||
"""Схема для создания категории тестов"""
|
||||
name: str = Field(..., max_length=100, description="Название категории")
|
||||
description: Optional[str] = Field(None, description="Описание категории")
|
||||
|
||||
class TestCategoryResponse(BaseModel):
|
||||
"""Схема ответа с категорией тестов"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
name: str
|
||||
description: Optional[str]
|
||||
created_at: datetime
|
||||
|
||||
class TestCreate(BaseModel):
|
||||
"""Схема для создания теста"""
|
||||
title: str = Field(..., max_length=200, description="Название теста")
|
||||
description: Optional[str] = Field(None, description="Описание теста")
|
||||
category_id: Optional[int] = Field(None, description="ID категории")
|
||||
is_active: bool = Field(default=True, description="Активен ли тест")
|
||||
time_limit_minutes: Optional[int] = Field(None, ge=1, description="Лимит времени в минутах")
|
||||
|
||||
class TestResponse(BaseModel):
|
||||
"""Схема ответа с тестом"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
title: str
|
||||
description: Optional[str]
|
||||
category_id: Optional[int]
|
||||
is_active: bool
|
||||
time_limit_minutes: Optional[int]
|
||||
created_at: datetime
|
||||
updated_at: Optional[datetime]
|
||||
|
||||
class QuestionCreate(BaseModel):
|
||||
"""Схема для создания вопроса"""
|
||||
test_id: int = Field(..., description="ID теста")
|
||||
question_text: str = Field(..., description="Текст вопроса")
|
||||
question_type: str = Field(default="single_choice", description="Тип вопроса")
|
||||
order_number: int = Field(..., ge=1, description="Порядковый номер вопроса")
|
||||
points: int = Field(default=1, ge=0, description="Количество баллов за правильный ответ")
|
||||
image_id: Optional[int] = Field(None, description="ID изображения к вопросу")
|
||||
|
||||
class QuestionResponse(BaseModel):
|
||||
"""Схема ответа с вопросом"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
test_id: int
|
||||
question_text: str
|
||||
question_type: str
|
||||
order_number: int
|
||||
points: int
|
||||
image_id: Optional[int]
|
||||
created_at: datetime
|
||||
|
||||
class AnswerOptionCreate(BaseModel):
|
||||
"""Схема для создания варианта ответа"""
|
||||
question_id: int = Field(..., description="ID вопроса")
|
||||
option_text: str = Field(..., description="Текст варианта ответа")
|
||||
is_correct: bool = Field(..., description="Правильный ли этот вариант")
|
||||
order_number: int = Field(..., ge=1, description="Порядковый номер варианта")
|
||||
|
||||
class AnswerOptionResponse(BaseModel):
|
||||
"""Схема ответа с вариантом ответа"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
question_id: int
|
||||
option_text: str
|
||||
is_correct: bool
|
||||
order_number: int
|
||||
created_at: datetime
|
||||
|
||||
class ImageUploadResponse(BaseModel):
|
||||
"""Схема ответа при загрузке изображения"""
|
||||
id: int
|
||||
filename: str
|
||||
content_type: str
|
||||
file_size: int
|
||||
message: str = "Изображение успешно загружено"
|
||||
Reference in New Issue
Block a user