Automated Action 62cd6ed746 Implement comprehensive Task Manager API with FastAPI and SQLite
- Add complete CRUD operations for task management
- Implement task filtering by status, priority, and search
- Add task statistics endpoint for summary data
- Configure SQLite database with Alembic migrations
- Set up FastAPI with CORS support and API documentation
- Include health check endpoint and base URL information
- Add comprehensive README with API usage examples
- Structure project with proper separation of concerns
2025-07-02 13:24:05 +00:00

23 lines
521 B
Python

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from pathlib import Path
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()