fix(packs): remove unfiltered pre-count in GET /packs (3 round-trips to 2) #211

Merged
cal merged 1 commits from autonomous/packs-remove-prefilter-count into main 2026-04-10 11:45:54 +00:00

1 Commits

Author SHA1 Message Date
Cal Corum
7f7d9ffe1f fix(packs): remove unfiltered pre-count in GET /packs (3 round-trips → 2)
Remove Pack.select().count() on the unfiltered table at the top of GET
/api/v2/packs. This check raised 404 if zero packs existed globally —
wrong for filtered queries where no match is the expected empty-list
result. The filtered count at the end of the handler already handles
the empty-result case. Endpoint now returns {count: 0, packs: []} on
empty filter matches (standard REST pattern) and saves one DB round-trip
per request.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 11:45:34 +00:00