
- Add priority field to Todo model - Update Pydantic schemas with priority field - Create Alembic migration for priority column - Add filter by priority to GET /todos endpoint - Update README with new feature details generated with BackendIM... (backend.im)
14 lines
565 B
Python
14 lines
565 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime
|
|
from sqlalchemy.sql import func
|
|
from app.db.database import Base
|
|
|
|
class Todo(Base):
|
|
__tablename__ = "todos"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String, index=True)
|
|
description = Column(String)
|
|
completed = Column(Boolean, default=False)
|
|
priority = Column(Integer, default=1, index=True) # 1: Low, 2: Medium, 3: High
|
|
created_at = Column(DateTime, default=func.now())
|
|
updated_at = Column(DateTime, default=func.now(), onupdate=func.now()) |