Automated Action 8557c1426e Enhance Todo application with advanced features
- Add due dates and priority level to todos
- Add tags/categories for better organization
- Implement advanced search and filtering
- Create database migrations for model changes
- Add endpoints for managing tags
- Update documentation

generated with BackendIM... (backend.im)
2025-05-12 23:29:41 +00:00

55 lines
1.3 KiB
Python

from pydantic import BaseModel, Field
from typing import Optional, List
from datetime import datetime
from enum import Enum
class PriorityLevel(str, Enum):
LOW = "low"
MEDIUM = "medium"
HIGH = "high"
class TagBase(BaseModel):
name: str = Field(..., min_length=1, max_length=50)
class TagCreate(TagBase):
pass
class TagResponse(TagBase):
id: int
created_at: datetime
class Config:
from_attributes = True
class TodoBase(BaseModel):
title: str = Field(..., min_length=1, max_length=100)
description: Optional[str] = None
completed: bool = False
priority: PriorityLevel = PriorityLevel.MEDIUM
due_date: Optional[datetime] = None
class TodoCreate(TodoBase):
tag_ids: Optional[List[int]] = []
class TodoCreateWithTags(TodoBase):
tags: Optional[List[str]] = []
class TodoUpdate(BaseModel):
title: Optional[str] = Field(None, min_length=1, max_length=100)
description: Optional[str] = None
completed: Optional[bool] = None
priority: Optional[PriorityLevel] = None
due_date: Optional[datetime] = None
tag_ids: Optional[List[int]] = None
class TodoResponse(TodoBase):
id: int
created_at: datetime
updated_at: Optional[datetime] = None
tags: List[TagResponse] = []
class Config:
from_attributes = True
class HealthResponse(BaseModel):
status: str