Implement DDS exercise, customer UI and local demo
This commit is contained in:
parent
cec84ffcd0
commit
0526b11f91
46 changed files with 2504 additions and 253 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
from collections.abc import AsyncIterator
|
||||
|
||||
from fastapi import HTTPException
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
|
||||
from sqlalchemy.orm import DeclarativeBase
|
||||
|
||||
|
|
@ -45,5 +46,7 @@ def reset() -> None:
|
|||
|
||||
async def get_session() -> AsyncIterator[AsyncSession]:
|
||||
"""Зависимость FastAPI: сессия на запрос, коммит явный."""
|
||||
if get_settings().demo_no_db:
|
||||
raise HTTPException(status_code=503, detail="database_disabled_demo")
|
||||
async with get_sessionmaker()() as session:
|
||||
yield session
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ async def ensure_session(
|
|||
scenario_id=scenario_id,
|
||||
mode=mode,
|
||||
trainee_id=trainee.id if trainee else None,
|
||||
group_id=group.id if group else None,
|
||||
group_id=group.id if group else trainee.group_id if trainee else None,
|
||||
session_id=session_id,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue