Automated Action f19a6fea04 Build complete Personal Task Management API with FastAPI
- Implemented user authentication with JWT tokens
- Created comprehensive task management with CRUD operations
- Added category system for task organization
- Set up SQLite database with SQLAlchemy ORM
- Configured Alembic for database migrations
- Added API documentation with OpenAPI/Swagger
- Implemented proper authorization and user scoping
- Created health check and root endpoints
- Updated README with complete documentation
2025-06-21 16:16:40 +00:00

26 lines
605 B
Python

from pathlib import Path
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from app.db.base import Base
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()
def create_tables():
Base.metadata.create_all(bind=engine)