feat: add integration tests for project and scenario lifecycles, update templates to new Starlette signature, and optimize project retrieval logic

This commit is contained in:
2025-11-09 19:47:35 +01:00
parent dad862e48e
commit 2d848c2e09
10 changed files with 292 additions and 72 deletions

View File

@@ -40,7 +40,10 @@ class ProjectRepository:
stmt = select(Project).where(Project.id == project_id)
if with_children:
stmt = stmt.options(joinedload(Project.scenarios))
project = self.session.execute(stmt).scalar_one_or_none()
result = self.session.execute(stmt)
if with_children:
result = result.unique()
project = result.scalar_one_or_none()
if project is None:
raise EntityNotFoundError(f"Project {project_id} not found")
return project