| 05-visibility-and-client-portal |
01 |
api |
| dashboard |
| metrics |
| prisma |
| aggregate |
| revenue |
| overdue |
| cash-flow |
|
| phase |
provides |
| 02-subscriber-and-billing-core |
Payment, Invoice, Subscriber models and JournalEntryService |
|
| phase |
provides |
| 03-operational-modules |
Collection, Remittance models and collector workflow |
|
| phase |
provides |
| 04-inventory-expenses-reports |
Expense JE patterns and FinancialReportService cash flow approach |
|
|
| DashboardService with 6 metric aggregation methods |
| GET /api/dashboard endpoint returning composite dashboard metrics |
| Integration tests verifying all metric accuracy |
|
| 05-02 (dashboard UI will consume this API) |
| 05-05 (e2e tests) |
|
| added |
patterns |
|
|
| Dashboard metric aggregation via Prisma aggregate/groupBy |
| Parallel Promise.all for independent metric queries |
|
|
| created |
| src/lib/services/dashboard-service.ts |
| src/app/api/dashboard/route.ts |
| src/lib/__tests__/dashboard-service.test.ts |
|
|
| Revenue metrics use Payment.createdAt (not paymentDate) for today/month filtering -- createdAt is when the record was created in the system |
| Cash flow uses same approach as FinancialReportService.getIncomeStatement -- POSTED JE lines on revenue (4xxx) and expense (5xxx) accounts with normal balance logic |
| Collector summary uses Collection.createdAt for today filter and Remittance PENDING status for unverified count (SUBMITTED maps to PENDING enum) |
| getDashboardSummary runs all 5 metric methods in parallel via Promise.all for efficiency |
|
| Dashboard aggregation pattern: static class methods accepting TenantPrismaClient + tenantId, returning typed metric interfaces |
|
3min |
2026-03-05 |