shoc-frontend-new/docs/work-orders/pending-be-contract.md
arthur.bassi d93ae683c7 fix(work-orders): restore additionalContacts contract and name+phone extras (SH-218)
Document the backend #66 producer, drop incomplete extras from persist, and show the same required-field errors on POC 2+.
2026-08-18 10:03:14 -03:00

30 lines
1.4 KiB
Markdown

# Work-order `additionalContacts` contract (SH-218)
Authoritative frontend contract for additional POC 2+ contacts. Implemented on
backend PR [shoc-backend#66](https://github.com/Sea-Haven-Industries/shoc-backend/pull/66).
## Shape
```ts
{ name: string; phone: string; notes?: string }
```
- Primary POC remains `pocName` / `pocPhone` / `pocNotes`.
- `additionalContacts` holds ordered POC 2+ only.
- Notes are optional. An empty list (or omitted field) is valid.
- Retained entries require **both** `name` and `phone`. Fully blank placeholder
rows are dropped and must not fail create. Name-only or phone-only entries are
rejected on POST create and PATCH.
## Endpoints
| Operation | Where |
| ------------------ | ------------------------------------------------------------- |
| POST create | `additionalContacts` array on the board create body |
| GET board / search | `additionalContacts` on each board row |
| GET detail | `info.additionalContacts` (same ordered list as board) |
| PATCH | `field: "additionalContacts"`, `value` is a JSON array string |
Until #66 is merged to the deployed API, a missing field is still mapped as `[]`
on the frontend so the UI does not throw. After merge, create → reload →
board/slide-over must round-trip the ordered list through GET detail `info`.