Fixing the “D. map is not a function” crash by tightening DB indexes and normalizing the API payload TL;DR: I added missing PostgreSQL indexes in apps/api/src/db/db. ts and forced the /condos/metrics endpoint to always return an array.

Source: [Dev.to](https://dev.to/zaerohell/fixing-the-dmap-is-not-a-function-crash-by-tightening-db-indexes-and-normalizing-the-api-payload-1bno)

Sponsored