Automated Action 091c42482c Add todo categories and due dates with filtering capabilities
- Added category field to Todo model for organizing todos
- Added due_date field with timezone support for deadline tracking
- Enhanced CRUD operations with filtering by category, completion status, and overdue items
- Added new API endpoints for category-based and overdue todo retrieval
- Updated API documentation with new filtering query parameters
- Created database migration for new fields with proper indexing
- Updated README with comprehensive feature documentation
2025-06-17 05:51:35 +00:00

20 lines
676 B
Python

from sqlalchemy import Boolean, Column, Integer, String, DateTime
from sqlalchemy.sql import func
from app.db.base import Base
class Todo(Base):
"""SQLAlchemy model for a Todo item."""
__tablename__ = "todos"
id = Column(Integer, primary_key=True, index=True)
title = Column(String, index=True)
description = Column(String, nullable=True)
completed = Column(Boolean, default=False)
category = Column(String, nullable=True, index=True)
due_date = Column(DateTime(timezone=True), nullable=True)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())