Automated Action 5b2cda28a1 Add todo priority and due date features
- 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
2025-06-17 02:34:55 +00:00

25 lines
755 B
Python

from enum import Enum as PyEnum
from sqlalchemy import Boolean, Column, DateTime, Enum, ForeignKey, Integer, String, Text
from sqlalchemy.orm import relationship
from app.db.base import Base
class PriorityLevel(str, PyEnum):
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(Text, nullable=True)
is_completed = Column(Boolean, default=False)
priority = Column(Enum(PriorityLevel), default=PriorityLevel.MEDIUM)
due_date = Column(DateTime, nullable=True)
owner_id = Column(Integer, ForeignKey("users.id"))
owner = relationship("User", back_populates="todos")