Automated Action 10172c55ca Implement comprehensive Task Manager API with FastAPI
Added complete task management functionality including:
- CRUD operations for tasks (create, read, update, delete)
- Task model with status (pending/in_progress/completed) and priority (low/medium/high)
- SQLite database with SQLAlchemy ORM
- Alembic migrations for database schema
- Pydantic schemas for request/response validation
- FastAPI routers with proper error handling
- Filtering and pagination support
- Health check endpoint
- CORS configuration
- Comprehensive API documentation
- Proper project structure following FastAPI best practices
2025-06-20 19:34:58 +00:00

23 lines
510 B
Python

from pathlib import Path
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
DB_DIR = Path("/app/storage/db")
DB_DIR.mkdir(parents=True, exist_ok=True)
SQLALCHEMY_DATABASE_URL = f"sqlite:///{DB_DIR}/db.sqlite"
engine = create_engine(
SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()