GRO-2172: add missing extended pet fields to create/update schemas #199

Merged
Flea Flicker merged 2 commits from fix/gro-2172-pet-extended-fields into dev 2026-06-09 08:56:23 +00:00
Member

GRO-2172 — add missing extended pet fields to create/update schemas

Adds 4 extended pet profile fields to createPetSchema (and via .partial() to updatePetSchema) in src/routes/pets.ts. These columns exist (migrations 0034/0036) and are populated by seed data, but were missing from the Zod schemas, so POST/PATCH /api/pets silently dropped them. GRO-1472 was the original UAT regression.

Field Zod type DB column
temperamentScore z.number().int().min(1).max(5) integer
temperamentFlags z.array(z.string().max(100)).max(20) jsonb / string[]
medicalAlerts z.array(z.object({type,description,severity})).max(50) jsonb / MedicalAlert[]
preferredCuts z.array(z.string().max(200)).max(20) jsonb / string[]

Handler

  • POST / and PATCH /:id now destructure medicalAlerts and cast for the jsonb column (the @groombook/types MedicalAlert has an optional server-generated id). The other 3 fields flow through ...rest.

Notes

  • Net diff is a single file: src/routes/pets.ts (+26/−2). Branch was rebrought current with dev (was 26 commits behind).
  • QA reviewed the field logic on 77a6ad5 (GRO-2310) — PASS.
  • Parity with apps/api/src/routes/pets.ts confirmed.

UAT Playbook

No update needed — UAT_PLAYBOOK.md §3 already documents these via TC-API-3.8 → TC-API-3.15 (create/update with extended fields + all boundary rejections).

Refs: GRO-2172, GRO-1472, GRO-1178

cc @cpfarhood

## GRO-2172 — add missing extended pet fields to create/update schemas Adds 4 extended pet profile fields to `createPetSchema` (and via `.partial()` to `updatePetSchema`) in `src/routes/pets.ts`. These columns exist (migrations 0034/0036) and are populated by seed data, but were missing from the Zod schemas, so `POST`/`PATCH /api/pets` silently dropped them. GRO-1472 was the original UAT regression. | Field | Zod type | DB column | |---|---|---| | `temperamentScore` | `z.number().int().min(1).max(5)` | `integer` | | `temperamentFlags` | `z.array(z.string().max(100)).max(20)` | `jsonb / string[]` | | `medicalAlerts` | `z.array(z.object({type,description,severity})).max(50)` | `jsonb / MedicalAlert[]` | | `preferredCuts` | `z.array(z.string().max(200)).max(20)` | `jsonb / string[]` | ### Handler - `POST /` and `PATCH /:id` now destructure `medicalAlerts` and cast for the jsonb column (the `@groombook/types` `MedicalAlert` has an optional server-generated `id`). The other 3 fields flow through `...rest`. ### Notes - Net diff is a single file: `src/routes/pets.ts` (+26/−2). Branch was rebrought current with `dev` (was 26 commits behind). - QA reviewed the field logic on `77a6ad5` (GRO-2310) — PASS. - Parity with `apps/api/src/routes/pets.ts` confirmed. ### UAT Playbook No update needed — `UAT_PLAYBOOK.md` §3 already documents these via **TC-API-3.8 → TC-API-3.15** (create/update with extended fields + all boundary rejections). Refs: GRO-2172, GRO-1472, GRO-1178 cc @cpfarhood
Flea Flicker added 2 commits 2026-06-09 08:51:23 +00:00
createPetSchema in src/routes/pets.ts was missing temperamentScore,
temperamentFlags, medicalAlerts, and preferredCuts. Migrations 0034/0036
and seed data populate them, but POST/PATCH silently dropped the fields
because Zod validation rejected them. GET worked because seed bypassed
the schema. This is the regression originally reported as GRO-1472 and
blocks the GRO-1178 extended-profile feature rollout (api/#39).

Mirrors the field shape that already lives in apps/api/src/routes/pets.ts
(legacy duplicate) and the test expectations in
apps/api/src/__tests__/petsExtendedFields.test.ts:

- temperamentScore: int 1–5
- temperamentFlags: string[] (max 20, item max 100)
- medicalAlerts: { type, description, severity: low|medium|high }[] (max 50)
- preferredCuts: string[] (max 20, item max 200)

updatePetSchema inherits from createPetSchema.partial().omit({ clientId })
so no separate change is needed there.

POST/PATCH handlers now forward medicalAlerts through to the insert/update
with a localized cast — the @groombook/types MedicalAlert includes a
server-generated id that is not part of the API request shape, and the
jsonb column is schemaless at runtime.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Merge dev into fix/gro-2172-pet-extended-fields (bring current)
CI / Test (pull_request) Successful in 29s
CI / Lint & Typecheck (pull_request) Successful in 34s
CI / Build & Push Docker Images (pull_request) Successful in 3m54s
13a9f6a58d
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Flea Flicker merged commit 2853ce73a5 into dev 2026-06-09 08:56:23 +00:00
Sign in to join this conversation.