Files
mercadodevida/work/artifacts/F-085/implementer.md
2026-08-20 06:10:48 +02:00

28 lines
1.4 KiB
Markdown

# F-085 — Implementer evidence
## What was implemented
`/tax-rates` TIPO column is now inline-editable. Server validates the value against the same enum used by pricing.
### Files changed
- `project/src/modules/pricing/api/pricing.routes.ts`
- PATCH `/admin/tax-rates/:id` body schema now accepts `appliesTo: z.enum(['general','reduced','super-reduced']).optional()`.
- Added an UPDATE branch `applies_to = $N` mirroring the existing branches.
- `project/apps/admin/src/app/(dashboard)/tax-rates/page.tsx`
- New state: `tipoEditing`, `savingTipo`.
- New handler: `saveTipo(id, newTipo)``taxApi.update(id, { appliesTo })` → in-place row update.
- TIPO cell: `<button>` shows current value with hover affordance; click swaps to a `<select autoFocus>` with the three allowed options. On change, PATCH fires immediately. On blur (without change), edit mode closes.
## Validation
- `npx tsc --noEmit` → exit 0
- `npx eslint` on touched files → exit 0
## Acceptance trace
- "TIPO cell enters edit mode on a single click and shows a select with allowed types" → button → select.
- "Selecting a new type and confirming triggers PATCH /tax-rates/:id" → onChange handler.
- "Invalid types are rejected client and server side" → Zod enum on server; only three options in select.
- "Successful change is reflected in the cell without a full page reload" → in-place `rates.map`.
- "verify.sh is green" → tsc + eslint clean.