fix: re-fetch inventory item after insert to populate product_name (#99)
This commit is contained in:
parent
38382a4fc9
commit
bea61054fa
1 changed files with 4 additions and 1 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue