Automated Action 357c328042 Add categories, priorities and due dates to Todo app
- Added category, priority and due_date fields to Todo model
- Created Enum for priority levels (low, medium, high)
- Added advanced filtering in CRUD and API routes
- Added statistics endpoint for todo analytics
- Created Alembic migration for new fields
- Updated README with new feature documentation

generated with BackendIM... (backend.im)
2025-05-13 03:56:40 +00:00

23 lines
821 B
Python

from sqlalchemy import Column, Integer, String, Boolean, DateTime, Enum
from sqlalchemy.sql import func
import enum
from app.db.base import Base
class PriorityEnum(enum.Enum):
LOW = "low"
MEDIUM = "medium"
HIGH = "high"
class Todo(Base):
__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)
priority = Column(Enum(PriorityEnum), default=PriorityEnum.MEDIUM, nullable=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())