Automated Action 6f269066a5 Implement task management tool with FastAPI and SQLite
This commit includes:
- Project structure and configuration
- Database models for tasks, users, and categories
- Authentication system with JWT
- CRUD endpoints for tasks and categories
- Search, filter, and sorting functionality
- Health check endpoint
- Alembic migration setup
- Documentation
2025-06-03 07:48:27 +00:00

29 lines
647 B
Python

from pathlib import Path
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
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)
Base = declarative_base()
# Dependency to get the database session
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()