Fix N+1 query pattern in events findAll() #12
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context:
events.service.tsfindAll()fetches all events, then loops through each to enrich with additional VIP data, creating an N+1 query pattern.File:
backend/src/events/events.service.ts(lines 88-105)Suggested fix:
includewith nested selects to fetch all needed VIP data in the initial queryEffort: Small
Refactored events to use Prisma includes instead of N+1 per-event enrichment loop.