API: Add GET /api/items/by-uuid/{uuid} endpoint #43
Reference in New Issue
Block a user
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?
Summary
Add a new endpoint to resolve a Silo item UUID to its full item response. This is needed by the silo-mod BOM sync feature — FreeCAD documents store the item's UUID as a custom property (
SiloUUID), and the client needs to resolve that to a part number before submitting a BOM merge.Endpoint
Response: Same
ItemResponseJSON asGET /api/items/{partNumber}.Errors:
404if UUID not found or item is archived400if UUID format is invalidImplementation
Database layer (
internal/db/items.go)ItemRepositoryalready hasGetByID(ctx, id string)which queries by UUID primary key. This can be reused directly — the item'sidcolumn IS the stable UUID.Handler (
internal/api/handlers.go)New handler
HandleGetItemByUUID:{uuid}from URL viachi.URLParam(r, "uuid")s.queries.Items.GetByID(ctx, uuid)ItemResponseasHandleGetItemRoute (
internal/api/routes.go)Register in the viewer-accessible
/apigroup:Notes
idcolumn (UUID) is the stable identifier across revisions — this is exactly what silo-mod stores asSiloUUIDGetByIDalready does this