meta-form-3: возвращаем метаданные по столбцам для формы 3 #112
@ -312,14 +312,28 @@ class ProjectRepository:
|
|||||||
query = query.where(Project.org_unit_id.in_(org_unit_ids))
|
query = query.where(Project.org_unit_id.in_(org_unit_ids))
|
||||||
return (await self.db.execute(query)).scalar_one_or_none()
|
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(
|
query = text(
|
||||||
"""
|
"""
|
||||||
SELECT row_type, depth, sort_order, data
|
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(
|
async def get_rf_rollup_rows(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@ -101,7 +101,7 @@ class ProjectService:
|
|||||||
report_id = await self.resolve_report_id(project_id, year, report_type, user)
|
report_id = await self.resolve_report_id(project_id, year, report_type, user)
|
||||||
if not report_id:
|
if not report_id:
|
||||||
raise ValidationException("Отчёт не найден")
|
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(
|
async def get_rf_rollup_rows(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user