WIP checkpoint: Address review feedback: Scaffold FastAPI backend project structure

This commit is contained in:
2026-08-17 23:31:01 +00:00
parent b547ca5785
commit 1f85ecc812
+6 -2
View File
@@ -28,11 +28,15 @@ class Base(DeclarativeBase):
async def get_db() -> AsyncSession: async def get_db() -> AsyncSession:
"""Dependency that yields an async database session.""" """Dependency that yields an async database session.
Handlers are responsible for committing or rolling back their own
transactions. This avoids the double-commit problem where the
session is committed both here and in the handler.
"""
async with async_session_factory() as session: async with async_session_factory() as session:
try: try:
yield session yield session
await session.commit()
except Exception: except Exception:
await session.rollback() await session.rollback()
raise raise