
- Added priority field (low, medium, high) to Todo model - Created migration for priority field addition - Updated API schemas to include priority - Added filtering by priority in GET todos endpoint - Updated README to reflect new features
23 lines
704 B
Python
23 lines
704 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime, Enum
|
|
from sqlalchemy.sql import func
|
|
import enum
|
|
from app.database.config import Base
|
|
|
|
|
|
class PriorityLevel(str, 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)
|
|
priority = Column(Enum(PriorityLevel), default=PriorityLevel.MEDIUM, nullable=False)
|
|
created_at = Column(DateTime, default=func.now())
|
|
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())
|