Frontend: add bucket #54

Closed
opened 2026-06-26 00:04:07 +02:00 by myrmidex · 0 comments
Owner

Context

Split from #34. A user can add a bucket to a scenario they own. Uses the existing POST /api/buckets.

Scope

  • Add-bucket form/UI on the scenario show page: name, type (need/want/overflow), allocation type (fixed_limit/percentage/unlimited), allocation value, priority, buffer multiplier.
  • Submit → POST /api/buckets with Content-Type: application/ld+json (required — see PLATFORM.md CSRF note) referencing the scenario IRI.
  • On success: bucket appears in the list (refetch or optimistic insert).
  • Surface validation errors from the 422 body ({violations:[{propertyPath,message}]}) inline per field.
  • Respect the domain invariants (will come back as 422): exactly one overflow bucket per scenario; overflow must be unlimited allocation; unique priority per scenario; buffer only for fixed_limit.

Notes

  • A POST under a scenario IRI the user doesn't own returns 400 (unresolvable IRI — see PLATFORM.md "WRITE side for foreign IRIs"). Not a normal flow (the UI only offers the user's own scenarios) but handle non-201 gracefully.

Depends on

  • #33 (scaffold), #53 (scenario show page to host the form)

Out of scope

  • Editing/deleting buckets (blocked on backend PATCH/DELETE — separate tickets).

Testing

  • Per SPA test setup; cover happy path + a validation-error render + an invariant-violation (e.g. second overflow → 422).
## Context Split from #34. A user can add a bucket to a scenario they own. Uses the existing `POST /api/buckets`. ## Scope - Add-bucket form/UI on the scenario show page: name, type (need/want/overflow), allocation type (fixed_limit/percentage/unlimited), allocation value, priority, buffer multiplier. - Submit → `POST /api/buckets` with `Content-Type: application/ld+json` (required — see PLATFORM.md CSRF note) referencing the scenario IRI. - On success: bucket appears in the list (refetch or optimistic insert). - Surface validation errors from the 422 body (`{violations:[{propertyPath,message}]}`) inline per field. - Respect the domain invariants (will come back as 422): exactly one overflow bucket per scenario; overflow must be unlimited allocation; unique priority per scenario; buffer only for fixed_limit. ## Notes - A `POST` under a scenario IRI the user doesn't own returns **400** (unresolvable IRI — see PLATFORM.md "WRITE side for foreign IRIs"). Not a normal flow (the UI only offers the user's own scenarios) but handle non-201 gracefully. ## Depends on - #33 (scaffold), #53 (scenario show page to host the form) ## Out of scope - Editing/deleting buckets (blocked on backend PATCH/DELETE — separate tickets). ## Testing - Per SPA test setup; cover happy path + a validation-error render + an invariant-violation (e.g. second overflow → 422).
myrmidex added this to the v0.3.0 milestone 2026-06-26 00:04:07 +02:00
myrmidex added the
enhancement
label 2026-06-26 00:04:07 +02:00
myrmidex self-assigned this 2026-06-26 00:04:08 +02:00
myrmidex added a new dependency 2026-06-26 00:11:24 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference: lvl0/buckets#54
No description provided.