27 lines
461 B
Python
27 lines
461 B
Python
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]
|