fix(delivery-note-editor): the pricing route is PATCH, not POST

"Could not save line 'Husqvarna 578BTF backpack leaf blower' (405)" —
and nothing was written.

`/api/v1/delivery-notes/items/[id]/pricing` exports PATCH only. The
editor POSTed to it, so every save 405'd. The DN detail page has been
PATCHing the same URL correctly all along; I should have matched it
rather than assuming POST.

## Why it got through my verification

My browser check opened the editor, typed a cost, watched the totals
recompute — and stopped there. The save path is entirely separate
from the render path, and I never pressed Save, so I verified the one
half that was never broken.

Redone properly: changed a quantity 150 -> 7, pressed Save, reopened
the editor and read 7 back (the other three lines untouched at
150/150/2), then put it back to 150 so the data is as found. That is
the check that matters on these screens — display and persistence are
different code paths, and a perfectly-rendering dialog proves nothing
about either.

Suite: 3817 passing, tsc clean.
This commit is contained in:
Dave 2026-10-09 10:22:28 +02:00
parent 58831683d4
commit f0c8787e3f

View file

@ -159,7 +159,10 @@ export function DeliveryNoteEditorDialog({
const res = await fetch(
`/api/v1/delivery-notes/items/${encodeURIComponent(line.orderItemId)}/pricing`,
{
method: "POST",
// PATCH, not POST. The route only exports PATCH, and a
// POST to it answers 405 — which surfaced as
// "Could not save line ... (405)" and saved nothing.
method: "PATCH",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
quantity: Math.max(1, Math.round(line.quantity)),