diff --git a/api/src/repository/project_repository.py b/api/src/repository/project_repository.py index 90f3d71..b70089c 100644 --- a/api/src/repository/project_repository.py +++ b/api/src/repository/project_repository.py @@ -312,14 +312,28 @@ class ProjectRepository: query = query.where(Project.org_unit_id.in_(org_unit_ids)) return (await self.db.execute(query)).scalar_one_or_none() - async def get_report_rows(self, report_id: int, sections: list[str] | None = None) -> list[tuple]: + async def get_report_rows( + self, + report_id: int, + sections: list[str] | None = None, + user_id: int | None = None, + ) -> list[tuple]: query = text( """ SELECT row_type, depth, sort_order, data - FROM v3.v_form3_report_jsonb(CAST(:report_id AS INT), CAST(:sections AS TEXT[])) + FROM v3.v_form3_report_jsonb( + CAST(:report_id AS INT), + CAST(:sections AS TEXT[]), + CAST(:user_id AS INT) + ) """ ) - return (await self.db.execute(query, {"report_id": report_id, "sections": sections})).all() + return ( + await self.db.execute( + query, + {"report_id": report_id, "sections": sections, "user_id": user_id}, + ) + ).all() async def get_rf_rollup_rows( self, diff --git a/api/src/services/project_service.py b/api/src/services/project_service.py index a81bf74..e468c17 100644 --- a/api/src/services/project_service.py +++ b/api/src/services/project_service.py @@ -101,7 +101,7 @@ class ProjectService: report_id = await self.resolve_report_id(project_id, year, report_type, user) if not report_id: raise ValidationException("Отчёт не найден") - return await self.project_repo.get_report_rows(report_id=report_id, sections=sections) + return await self.project_repo.get_report_rows(report_id=report_id, sections=sections, user_id=user.id) async def get_rf_rollup_rows( self,