
- Created FastAPI application structure with main.py and requirements.txt - Setup SQLite database with SQLAlchemy models for tasks - Implemented Alembic migrations for database schema management - Added CRUD endpoints for task management (GET, POST, PUT, DELETE) - Configured CORS middleware to allow all origins - Added health endpoint and base route with API information - Updated README with comprehensive documentation - Applied code formatting with Ruff linter
14 lines
650 B
Python
14 lines
650 B
Python
from datetime import datetime
|
|
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime
|
|
from app.db.base import Base
|
|
|
|
class Task(Base):
|
|
__tablename__ = "tasks"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String(200), 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, default=datetime.utcnow, nullable=False)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False) |