
- Created FastAPI application structure with main.py - Implemented SQLAlchemy models for tasks with priority and completion status - Set up database connection with SQLite using absolute paths - Created Alembic migrations for database schema - Added CRUD operations for task management - Implemented health check and root endpoints - Added CORS configuration for cross-origin requests - Created comprehensive API documentation - Added Ruff configuration for code linting - Updated README with installation and usage instructions
14 lines
645 B
Python
14 lines
645 B
Python
from sqlalchemy import Column, Integer, String, Text, DateTime, Boolean
|
|
from sqlalchemy.sql import func
|
|
from app.db.base import Base
|
|
|
|
class Task(Base):
|
|
__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, nullable=False)
|
|
priority = Column(String(20), default="medium", nullable=False)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now()) |