feat(silo): server-side BOM merge endpoint, UUID lookup, and SSE event #76

Closed
opened 2026-02-09 00:16:46 +00:00 by forbes · 0 comments
Owner

Phase 2 (server) — BOM Merge Endpoint + UUID Lookup + SSE Event

Ref: docs/BOM_MERGE.md Phases 1-2 & Section 5, issue #68
Required by: #73 (UUID resolution), Phase 2 client (merge submission)

Summary

Add server-side API endpoints and logic to support the assembly BOM merge workflow. This is the server counterpart to the client-side issues.

New Endpoints

GET /api/items/by-uuid/{uuid}

Resolve a Silo item UUID to its full item record. Used by the client to map SiloItemId document properties to part numbers during link extraction.

  • Returns the same item shape as GET /api/items/{partNumber}
  • 404 if UUID not found

POST /api/items/{partNumber}/bom/merge

Accept an assembly-derived BOM and merge it with the existing server BOM.

Request:

{
  "source": "assembly",
  "entries": [
    {"child_part_number": "PRT-100", "quantity": 1, "source": "assembly"}
  ]
}

Merge rules:

  • Added entries (in request, not on server): auto-add via existing add_bom_entry logic
  • Quantity changes: auto-update
  • Removed entries (on server, not in request): flag as unreferenced, do NOT delete
  • BOM entries with "source": "manual" are never overwritten by assembly merges

Response: Returns diff summary with added, removed, quantity_changed, unchanged arrays, warnings array for unreferenced items, and resolve_url for the web UI.

SSE Event

Emit bom_merge event on the activity stream after merge completes:

{
  "type": "bom_merge",
  "item": "ASM-001",
  "user": "...",
  "timestamp": "...",
  "summary": "BOM updated: 1 added, 1 quantity changed, 1 unreferenced",
  "resolve_url": "/items/ASM-001/bom"
}

Implementation Notes

  • Merge is synchronous (inline processing, no job queue)
  • BOM entries should carry a source field ("assembly" vs "manual") to distinguish origin
  • Existing BOM endpoints (GET .../bom, GET .../bom/expanded, GET .../bom/flat) remain unchanged
## Phase 2 (server) — BOM Merge Endpoint + UUID Lookup + SSE Event Ref: `docs/BOM_MERGE.md` Phases 1-2 & Section 5, issue #68 Required by: #73 (UUID resolution), Phase 2 client (merge submission) ### Summary Add server-side API endpoints and logic to support the assembly BOM merge workflow. This is the server counterpart to the client-side issues. ### New Endpoints #### `GET /api/items/by-uuid/{uuid}` Resolve a Silo item UUID to its full item record. Used by the client to map `SiloItemId` document properties to part numbers during link extraction. - Returns the same item shape as `GET /api/items/{partNumber}` - 404 if UUID not found #### `POST /api/items/{partNumber}/bom/merge` Accept an assembly-derived BOM and merge it with the existing server BOM. **Request:** ```json { "source": "assembly", "entries": [ {"child_part_number": "PRT-100", "quantity": 1, "source": "assembly"} ] } ``` **Merge rules:** - Added entries (in request, not on server): auto-add via existing `add_bom_entry` logic - Quantity changes: auto-update - Removed entries (on server, not in request): flag as unreferenced, do NOT delete - BOM entries with `"source": "manual"` are never overwritten by assembly merges **Response:** Returns diff summary with `added`, `removed`, `quantity_changed`, `unchanged` arrays, `warnings` array for unreferenced items, and `resolve_url` for the web UI. ### SSE Event Emit `bom_merge` event on the activity stream after merge completes: ```json { "type": "bom_merge", "item": "ASM-001", "user": "...", "timestamp": "...", "summary": "BOM updated: 1 added, 1 quantity changed, 1 unreferenced", "resolve_url": "/items/ASM-001/bom" } ``` ### Implementation Notes - Merge is synchronous (inline processing, no job queue) - BOM entries should carry a `source` field (`"assembly"` vs `"manual"`) to distinguish origin - Existing BOM endpoints (`GET .../bom`, `GET .../bom/expanded`, `GET .../bom/flat`) remain unchanged
forbes added the enhancement label 2026-02-09 00:16:46 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#76