Automated Action d60767d0ba Add categories and tags features
- 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
2025-06-17 02:52:26 +00:00

50 lines
1.1 KiB
Python

from datetime import datetime
from typing import List, Optional
from pydantic import BaseModel
from app.models.todo import PriorityLevel
from app.schemas.category import Category
from app.schemas.tag import Tag
# Shared properties
class TodoBase(BaseModel):
title: Optional[str] = None
description: Optional[str] = None
is_completed: Optional[bool] = False
priority: Optional[PriorityLevel] = PriorityLevel.MEDIUM
due_date: Optional[datetime] = None
category_id: Optional[int] = None
# Properties to receive on item creation
class TodoCreate(TodoBase):
title: str
tags: Optional[List[int]] = None # List of tag IDs
# Properties to receive on item update
class TodoUpdate(TodoBase):
tags: Optional[List[int]] = None # List of tag IDs
# Properties shared by models stored in DB
class TodoInDBBase(TodoBase):
id: int
title: str
owner_id: int
class Config:
from_attributes = True
# Properties to return to client
class Todo(TodoInDBBase):
category: Optional[Category] = None
tags: List[Tag] = []
# Properties properties stored in DB
class TodoInDB(TodoInDBBase):
pass