
- Add priority levels (low, medium, high) to Todo model - Add due date field to Todo model - Create Alembic migration for new fields - Update Todo schemas to include new fields - Enhance CRUD operations with priority and due date filtering - Update API endpoints to support new fields - Implement smart ordering by priority and due date - Update documentation to reflect changes
45 lines
875 B
Python
45 lines
875 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from app.models.todo import PriorityLevel
|
|
|
|
|
|
# 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
|
|
|
|
|
|
# Properties to receive on item creation
|
|
class TodoCreate(TodoBase):
|
|
title: str
|
|
|
|
|
|
# Properties to receive on item update
|
|
class TodoUpdate(TodoBase):
|
|
pass
|
|
|
|
|
|
# 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):
|
|
pass
|
|
|
|
|
|
# Properties properties stored in DB
|
|
class TodoInDB(TodoInDBBase):
|
|
pass |