Files
mercadodevida/work/artifacts/F-146/implementer.md
2026-08-22 12:52:13 +02:00

2.2 KiB

F-146 — Implementer evidence

What

F-146 build evidence: ReportingService (summary + sales) con CTEs SQL parametrizados, rutas GET /reporting/summary y GET /reporting/sales, tests unitarios 44/44 (reporting-service.test.ts 14 + reporting.routes.test.ts 15 + existing tests). Backend-only, no schema migration.

Files

  • src/modules/reporting/application/reporting-service.ts (created) — ReportingService con métodos summary() y sales().
  • src/modules/reporting/api/reporting.routes.ts (updated) — añade summary + sales endpoints.
  • src/modules/reporting/api/reporting.routes.test.ts (updated) — 8 tests nuevos para summary/sales.
  • src/modules/reporting/tests/reporting-service.test.ts (created) — 14 unit tests con mock pg.Pool.
  • src/modules/reporting/index.ts (updated) — re-exports ReportingService y tipos.
  • src/app/build-app.ts (updated) — pasa pool a registerReportingRoutes.

Tests

  • reporting-service.test.ts: 14 unit tests (mock pg.Pool) cubriendo summary(), sales(), filtros, paginación, groupBy (day/week/month/channel/store), dataAvailability.
  • reporting.routes.test.ts: 15 route tests (7 pre-existentes + 8 nuevos para summary/sales con mock pool).
  • Módulo completo: 44 tests passing.

Verification

  • npm run build → 0 TypeScript errors.
  • node scripts/check-module-boundaries.mjs src → 0 NEW violations.
  • ./scripts/verify.sh → green (F-146 in_progress, runtime-consistent).
  • Backlog: F-146 in_progress started via new_ticket.py --start F-146.

AC traceability

AC Estado Evidencia
AC1 summary endpoint route test 200 + DTO fields
AC2 sales grouped route test + unit test groupBy day/month/channel/store
AC3 filtros unit tests verify channel/storeId/terminalId in SQL params
AC4 paginación LIMIT $7 OFFSET $8 con page*pageSize
AC5 dataAvailability 14 tests verifican availability flags (available/unavailable)
AC6 compare range filtros + unit test verify compare=none/null
AC7 validation errors route tests 400 en fechas invertidas/channel inválido
AC8 RBAC customer forbidden 403 en summary y sales
AC9 tsc/tests/verify tsc 0, 44 tests, verify verde