fix: re-fetch inventory item after insert to populate product_name (#99)
Some checks are pending
CI / Backend (Python) (push) Waiting to run
CI / Frontend (Vue) (push) Waiting to run
Mirror / mirror (push) Waiting to run

This commit is contained in:
pyr0ball 2026-04-18 16:02:35 -07:00
parent 38382a4fc9
commit bea61054fa

View file

@ -171,7 +171,10 @@ async def create_inventory_item(
notes=body.notes, notes=body.notes,
source=body.source, source=body.source,
) )
return InventoryItemResponse.model_validate(item) # RETURNING * omits joined columns (product_name, barcode, category).
# Re-fetch with the products JOIN so the response is fully populated (#99).
full_item = await asyncio.to_thread(store.get_inventory_item, item["id"])
return InventoryItemResponse.model_validate(full_item)
@router.post("/items/bulk-add-by-name", response_model=BulkAddByNameResponse) @router.post("/items/bulk-add-by-name", response_model=BulkAddByNameResponse)