
- Fix unused imports in API endpoints - Add proper __all__ exports in model and schema modules - Add proper TYPE_CHECKING imports in models to prevent circular imports - Fix import order in migrations - Fix long lines in migration scripts - All ruff checks passing
49 lines
930 B
Python
49 lines
930 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
# Shared properties
|
|
class CategoryBase(BaseModel):
|
|
"""
|
|
Base schema for category data.
|
|
"""
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class CategoryCreate(CategoryBase):
|
|
"""
|
|
Schema for creating new categories.
|
|
"""
|
|
name: str
|
|
|
|
|
|
# Properties to receive via API on update
|
|
class CategoryUpdate(CategoryBase):
|
|
"""
|
|
Schema for updating category data.
|
|
"""
|
|
pass
|
|
|
|
|
|
class CategoryInDBBase(CategoryBase):
|
|
"""
|
|
Base schema for category data from the database.
|
|
"""
|
|
id: str
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Additional properties to return via API
|
|
class Category(CategoryInDBBase):
|
|
"""
|
|
Schema for category data to return via API.
|
|
"""
|
|
pass |