- Replace prisma.payment.findMany() with $queryRaw GROUP BY DATE_TRUNC
to push all aggregation work to the database, avoiding loading all
payment rows into application memory
- Add simple in-process 60s TTL cache keyed by startDate|endDate|groupBy
to reduce repeated expensive queries
- Cap date range to 366 days via custom @MaxDateRangeDays validator on RevenueStatsDto.endDate
Closes GOO-26
Co-Authored-By: Paperclip <noreply@paperclip.ing>