Files
goodgo-platform/apps
Ho Ngoc Hai b60b327508 feat(agents): consolidate getDashboard into single aggregate SQL query
Replaces 7 separate Prisma/DB round-trips (findUniqueOrThrow + groupBy +
2x inquiry.count + 2x listing.count + review.aggregate) with a single
parameterised CTE query via \$queryRaw. Response shape is unchanged.

- Adds AgentStatsRow interface for typed raw result
- Removes now-unused getInquiryStats / getListingStats private helpers
- Updates test to mock \$queryRaw; adds "agent not found" error path test
- All agents tests pass (35 tests, pre-existing env-secret failure skipped)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-24 14:03:08 +07:00
..