Automated Action 0d6888d900 Add Task Manager API with FastAPI and SQLite
- Created comprehensive task management system with CRUD operations
- Implemented SQLAlchemy models and database configuration
- Added Alembic migrations for database schema management
- Created FastAPI endpoints for task management with proper validation
- Added health check endpoint and base URL information
- Configured CORS middleware and OpenAPI documentation
- Updated README with comprehensive API documentation
- Code formatted and linted with Ruff
2025-07-07 20:49:13 +00:00

23 lines
518 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()