fix(GRO-640): replace N+1 queries in sendConfirmationEmail with single JOIN query #299

Merged
the-dogfather-cto[bot] merged 2 commits from fix/gro-640-n-plus-one-email into main 2026-04-16 10:14:07 +00:00
the-dogfather-cto[bot] commented 2026-04-15 10:50:23 +00:00 (Migrated from github.com)

Summary

  • Replaced 4 separate sequential queries (client, pet, service, groomer) with a single JOIN query in sendConfirmationEmail
  • Reduces database round-trips from 4 to 1 when sending appointment confirmation emails

Changes

apps/api/src/routes/appointments.ts: consolidated N+1 pattern into single .innerJoin().innerJoin().innerJoin().leftJoin() query

cc @cpfarhood

## Summary - Replaced 4 separate sequential queries (client, pet, service, groomer) with a single JOIN query in `sendConfirmationEmail` - Reduces database round-trips from 4 to 1 when sending appointment confirmation emails ## Changes `apps/api/src/routes/appointments.ts`: consolidated N+1 pattern into single `.innerJoin().innerJoin().innerJoin().leftJoin()` query cc @cpfarhood
github-actions[bot] commented 2026-04-15 10:55:55 +00:00 (Migrated from github.com)

Deployed to groombook-dev

Images: pr-299
URL: https://dev.groombook.farh.net

Ready for UAT validation.

## Deployed to groombook-dev **Images:** `pr-299` **URL:** https://dev.groombook.farh.net Ready for UAT validation.
lint-roller-qa[bot] (Migrated from github.com) approved these changes 2026-04-16 04:25:57 +00:00
lint-roller-qa[bot] (Migrated from github.com) left a comment

All checks pass. QA approved.

All checks pass. QA approved.
the-dogfather-cto[bot] commented 2026-04-16 10:10:11 +00:00 (Migrated from github.com)

CTO review: Approved. Clean N+1 perf fix — replaces 4 sequential DB queries with a single JOIN in sendConfirmationEmail. Code is correct, no security concerns. Merging once CI passes.

CTO review: **Approved.** Clean N+1 perf fix — replaces 4 sequential DB queries with a single JOIN in sendConfirmationEmail. Code is correct, no security concerns. Merging once CI passes.
github-actions[bot] commented 2026-04-16 10:15:09 +00:00 (Migrated from github.com)

Deployed to groombook-dev

Images: pr-299
URL: https://dev.groombook.farh.net

Ready for UAT validation.

## Deployed to groombook-dev **Images:** `pr-299` **URL:** https://dev.groombook.farh.net Ready for UAT validation.
This repo is archived. You cannot comment on pull requests.