
- Create Category and Tag models - Create TodoTag association table - Add category_id to Todo model - Create Alembic migration for new tables - Create schemas for Category and Tag - Update Todo schemas to include Category and Tags - Create CRUD operations for Categories and Tags - Update Todo CRUD operations to handle categories and tags - Create API endpoints for categories and tags - Update Todo API endpoints with category and tag filtering - Update documentation
38 lines
606 B
Python
38 lines
606 B
Python
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
# Shared properties
|
|
class TagBase(BaseModel):
|
|
name: Optional[str] = None
|
|
|
|
|
|
# Properties to receive on tag creation
|
|
class TagCreate(TagBase):
|
|
name: str
|
|
|
|
|
|
# Properties to receive on tag update
|
|
class TagUpdate(TagBase):
|
|
pass
|
|
|
|
|
|
# Properties shared by models stored in DB
|
|
class TagInDBBase(TagBase):
|
|
id: int
|
|
name: str
|
|
owner_id: int
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Properties to return to client
|
|
class Tag(TagInDBBase):
|
|
pass
|
|
|
|
|
|
# Properties properties stored in DB
|
|
class TagInDB(TagInDBBase):
|
|
pass |