fix(api): repair root src/routes/pets.ts visit-count query (GRO-1945) #107
Reference in New Issue
Block a user
Delete Branch "flea/GRO-1945-pets-visitcount-hotfix"
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?
Summary
Fixes TS2339 error in
src/routes/pets.ts:156that was blocking all Docker builds ondev.Root cause: The
profile-summaryroute usedselect({ count: appointments.id })with.limit(1), which undernoUncheckedIndexedAccessproducesT | undefined— destructuring{ count }fromundefinedis a type error.Fix: Replaced with
sql\count(*)::int`(matching the correctapps/api/src/routes/pets.ts:365), importedsqlfrom@groombook/db, and usedcountRow?.count ?? 0` for null-safety.Changes
src/routes/pets.ts: Addedsqlto@groombook/dbimportsrc/routes/pets.ts:156-161: Replaced broken visit-count query with correctcount(*)::intversionsrc/routes/pets.ts:199: ChangedNumber(count ?? 0)→visitCountTesting
CI includes Lint+Typecheck and Test; Docker Build& Push stage now passes (previously blocked by TS2339).
🤖 Generated with Claude Code