feat(backend): add Pydantic schemas

This commit is contained in:
2025-04-15 22:57:23 +01:00
parent 3ed51bce74
commit cccdad8768
6 changed files with 517 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
from uuid import UUID
from pydantic import BaseModel
class CategoryBase(BaseModel):
"""Base category schema."""
name: str
slug: str
description: str | None = None
class CategoryResponse(CategoryBase):
"""Category response schema."""
id: UUID
question_count: int = 0
model_config = {"from_attributes": True}
class CategoryListResponse(BaseModel):
"""Response for category list."""
items: list[CategoryResponse]