From bea61054fa3c42302494211ec20cdd5238bcb6d2 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Sat, 18 Apr 2026 16:02:35 -0700 Subject: [PATCH] fix: re-fetch inventory item after insert to populate product_name (#99) --- app/api/endpoints/inventory.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/api/endpoints/inventory.py b/app/api/endpoints/inventory.py index 61ee957..475013c 100644 --- a/app/api/endpoints/inventory.py +++ b/app/api/endpoints/inventory.py @@ -171,7 +171,10 @@ async def create_inventory_item( notes=body.notes, 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)