mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
Nuke the 17 hand-written raw-SQL reports (no pagination, hard LIMITs) and the reports module built around them. Replace with a resolver contract: a report declares columns/filters/permission and a TypeORM QueryBuilder; ReportRunnerService applies filtering, a whitelisted sort, offset/limit paging, and a COUNT(*) FROM (query) wrapper for the total (getCount() is wrong for GROUP BY). ReportExportService re-runs the same resolver unpaginated for xlsx (exceljs) and pdf (existing PdfRenderService, now landscape-capable) exports. Ships with 4 reports: bookings-list, revenue-by-customer, aging-receivables, contract-utilization. Catalog + per-report permission checks live in the controller; adding a report is one new definitions/ file plus a REPORT_KEYS entry, no frontend change.