Savannah Savings
|
23be6230ba
|
fix(portal): implement PATCH /portal/pets/:petId + enrich GET /portal/pets (GRO-2187)
CI / Test (pull_request) Successful in 12s
CI / Lint & Typecheck (pull_request) Successful in 16s
CI / Build & Push Docker Images (pull_request) Successful in 3m50s
The customer portal pet-save calls PATCH /api/portal/pets/{petId}, which the
deployed src/ tree never registered → 404, no persistence (UAT §5.23 / GRO-1480
regression). Also GET /portal/pets omitted the extended fields, so a write was
not visible on reload.
- Add portalRouter.patch("/pets/:petId", …) with ownership enforcement
(pet.clientId === portalClientId → 403, missing pet → 404), mirroring the
appointment-notes handler.
- Map the web payload to pets columns: name, breed, weightKg (accept
weightKg/weight), dateOfBirth (birthDate), groomingNotes (notes), healthAlerts,
photoKey (photoUrl), coatType, petSizeCategory (web "xlarge" → DB
"extra_large"), preferredCuts, medicalAlerts; set updatedAt.
- Reject invalid coatType/petSizeCategory with 422 (validated in-handler).
- Enrich GET /portal/pets with coatType, petSizeCategory, healthAlerts,
preferredCuts, medicalAlerts.
- Add src/__tests__/portalPets.test.ts: owner success + persistence, weight
fallback, non-owner 403, not-found 404, invalid enum 422, missing session 401.
- UAT_PLAYBOOK.md §4.8: add TC-API-8.12–8.15 for portal pet GET/PATCH.
coatType/petSizeCategory enums already present in packages/db/src/schema.ts.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
|
2026-06-08 08:13:12 +00:00 |
|