fix(portal): show Weight/DoB + Size Category in pet read view (GRO-2207) #54

Merged
Lint Roller merged 1 commits from fix/gro-2207-portal-pet-readview-fields into dev 2026-06-08 17:31:45 +00:00
Member

GRO-2207 — Portal Basic Info: Weight/DoB 'Unknown' + missing Size Category

Web-side, portal-scoped field-name mismatch. No API changeGET/PATCH /api/portal/pets is correct; it serializes weightKg→weight, dateOfBirth→birthDate, and already returns petSizeCategory. The portal read view read the staff-shaped keys, so populated pets showed "Unknown"; Size Category was never rendered.

Changes (portal only — 4 files + 1 new test)

  • packages/types/src/index.ts — add weight?: string|number|null and birthDate?: string|null alongside the existing weightKg/dateOfBirth (no rename — staff Clients.tsx/ClientDetailPage.tsx still use the raw DB shape and are untouched).
  • src/portal/sections/PetProfiles.tsx — header + Basic Info InfoRows read the portal keys (weight ?? weightKg, birthDate ?? dateOfBirth fallback); add a Size Category InfoRow via a formatSizeCategory helper (extra_large → "Extra Large", "Unknown" when null). BasicInfoTab/formatSizeCategory exported for testing.
  • src/portal/sections/PetForm.tsx — pre-fill weight from pet?.weight ?? pet?.weightKg. Submit unchanged (PATCH zod accepts both weight and weightKg).
  • Tests — new src/__tests__/PetProfiles.test.tsx (read view renders Weight "12.50 kg", DoB March 10, 2022, Size Extra Large; staff-key fallback; Unknown states; formatter unit) + PetForm pre-fill case.

Acceptance

  • Basic Info shows real Weight/DoB (not "Unknown") for populated pets, formatted DoB.
  • Size Category rendered (formatted) when petSizeCategory set.
  • Edit form pre-populates + saves (PATCH round-trips).
  • Staff pages untouched.
  • Root scripts green: lint (0 errors), typecheck, test (163 passed).

Severity low/cosmetic; data integrity was always fine.

🤖 Generated with Claude Code

## GRO-2207 — Portal Basic Info: Weight/DoB 'Unknown' + missing Size Category Web-side, portal-scoped field-name mismatch. **No API change** — `GET/PATCH /api/portal/pets` is correct; it serializes `weightKg→weight`, `dateOfBirth→birthDate`, and already returns `petSizeCategory`. The portal read view read the staff-shaped keys, so populated pets showed "Unknown"; Size Category was never rendered. ### Changes (portal only — 4 files + 1 new test) - **`packages/types/src/index.ts`** — add `weight?: string|number|null` and `birthDate?: string|null` **alongside** the existing `weightKg`/`dateOfBirth` (no rename — staff `Clients.tsx`/`ClientDetailPage.tsx` still use the raw DB shape and are untouched). - **`src/portal/sections/PetProfiles.tsx`** — header + Basic Info InfoRows read the portal keys (`weight ?? weightKg`, `birthDate ?? dateOfBirth` fallback); add a **Size Category** InfoRow via a `formatSizeCategory` helper (`extra_large → "Extra Large"`, `"Unknown"` when null). `BasicInfoTab`/`formatSizeCategory` exported for testing. - **`src/portal/sections/PetForm.tsx`** — pre-fill weight from `pet?.weight ?? pet?.weightKg`. Submit unchanged (PATCH zod accepts both `weight` and `weightKg`). - **Tests** — new `src/__tests__/PetProfiles.test.tsx` (read view renders Weight `"12.50 kg"`, DoB `March 10, 2022`, Size `Extra Large`; staff-key fallback; Unknown states; formatter unit) + PetForm pre-fill case. ### Acceptance - ✅ Basic Info shows real Weight/DoB (not "Unknown") for populated pets, formatted DoB. - ✅ Size Category rendered (formatted) when `petSizeCategory` set. - ✅ Edit form pre-populates + saves (PATCH round-trips). - ✅ Staff pages untouched. - ✅ Root scripts green: `lint` (0 errors), `typecheck`, `test` (163 passed). Severity low/cosmetic; data integrity was always fine. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Lint Roller added 1 commit 2026-06-08 17:29:52 +00:00
fix(portal): show Weight/DoB + Size Category in pet read view (GRO-2207)
CI / Test (pull_request) Successful in 20s
CI / Lint & Typecheck (pull_request) Successful in 26s
CI / Build & Push Docker Image (pull_request) Successful in 44s
0000ca8010
Portal GET /api/portal/pets serializes weightKg→weight and dateOfBirth→
birthDate. The portal read view read the staff-shaped keys, so populated
pets rendered 'Unknown'. Size Category (petSizeCategory) was never shown
in any read tab.

- packages/types: add portal-shaped weight?/birthDate? alongside the
  existing staff-side weightKg/dateOfBirth (no rename — staff Clients
  pages still use weightKg/dateOfBirth).
- PetProfiles: header + Basic Info InfoRows read portal keys with a
  fallback to staff keys; add a Size Category InfoRow with a
  formatSizeCategory helper (extra_large → 'Extra Large').
- PetForm: pre-fill weight from portal weight key with weightKg fallback.
- Tests: PetProfiles.test.tsx (read view + formatter) and a PetForm
  pre-fill case.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Lint Roller merged commit 3d0c3c551b into dev 2026-06-08 17:31:45 +00:00
Sign in to join this conversation.