Backend: embed buckets in the Scenario item representation #64
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
research
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Reference: lvl0/buckets#64
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Split out of #53 (frontend view-scenario). #53 needs to render a scenario's buckets, but the API has no clean way to fetch this scenario's buckets:
GET /api/bucketsreturns all of a user's buckets across every scenario. A?scenario=query filter (wrong for a resource-oriented API) and client-side filtering (papering over a missing capability) were both rejected. Buckets belong to the scenario, so they belong in the scenario's representation.This is a backend-only serialization change and must land before #53.
Scope
GET /api/scenarios/{id}returns the scenario with its buckets nested inline, so the frontend fetches one resource.OneToManysideScenario::$buckets(mappedByBucket.scenario,inversedByon the Bucket side). Mapping-only — no migration (the FK already exists onbucket.scenario_id).buckets; the collection op (GET /api/scenarios) does NOT (stays lean — names only).name, type, priority, sortOrder, allocationType, allocationValue, startingAmount, bufferMultiplier.sortOrder ASC.bucketsarray (no error).ownerIRI from the Scenario item representation (currently exposed implicitly; server-set, never client-relevant).Out of scope
GET /api/bucketscollection (kept — #54-#59 use the Bucket resource for writes).Testing (TDD)
Notes
cache:clear(dev + test) required after the entity/groups change — API Platform caches serialization metadata.Depends on: nothing. Blocks: #53.