feat(backend): add Pydantic schemas
This commit is contained in:
34
backend/src/schemas/stats.py
Normal file
34
backend/src/schemas/stats.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class DifficultyCount(BaseModel):
|
||||
"""Count of questions by difficulty."""
|
||||
|
||||
easy: int
|
||||
medium: int
|
||||
hard: int
|
||||
|
||||
|
||||
class CategoryCount(BaseModel):
|
||||
"""Question count for a category."""
|
||||
|
||||
name: str
|
||||
slug: str
|
||||
count: int
|
||||
|
||||
|
||||
class PatternCount(BaseModel):
|
||||
"""Question count for a pattern."""
|
||||
|
||||
name: str
|
||||
slug: str
|
||||
count: int
|
||||
|
||||
|
||||
class StatsResponse(BaseModel):
|
||||
"""Overall statistics response."""
|
||||
|
||||
total_questions: int
|
||||
by_difficulty: DifficultyCount
|
||||
by_category: list[CategoryCount]
|
||||
by_pattern: list[PatternCount]
|
||||
Reference in New Issue
Block a user