
- Set up FastAPI application structure - Create Task model with SQLAlchemy - Implement CRUD operations for tasks - Add API endpoints for tasks with filtering options - Configure Alembic for database migrations - Add health check endpoint - Configure Ruff for linting - Add comprehensive documentation in README.md
19 lines
720 B
Python
19 lines
720 B
Python
"""Task model definition."""
|
|
from sqlalchemy import Boolean, Column, DateTime, Integer, String, Text
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.db.base import Base
|
|
|
|
|
|
class Task(Base):
|
|
"""Task model for the tasks table."""
|
|
__tablename__ = "tasks"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String(255), nullable=False, index=True)
|
|
description = Column(Text, nullable=True)
|
|
completed = Column(Boolean, default=False)
|
|
priority = Column(Integer, default=1) # 1=Low, 2=Medium, 3=High
|
|
due_date = Column(DateTime, nullable=True)
|
|
created_at = Column(DateTime, server_default=func.now())
|
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now()) |