Automated Action c9baaa994e Create comprehensive Task Manager API with FastAPI
- Add user authentication with JWT tokens
- Implement task CRUD operations with status and priority
- Set up SQLite database with SQLAlchemy ORM
- Create Alembic migrations for database schema
- Add comprehensive API documentation
- Include health check endpoint and CORS configuration
- Structure codebase with proper separation of concerns
2025-06-20 19:35:55 +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()