add_inventory_item returns null product_name in create response #99
Labels
No labels
accessibility
backlog
beta-feedback
bug
duplicate
enhancement
feature-request
help wanted
invalid
needs-design
needs-triage
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Circuit-Forge/kiwi#99
Loading…
Reference in a new issue
No description provided.
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
POST /api/v1/inventory/itemsreturnsproduct_name: nullin the response even when the product exists.Steps to reproduce
POST /api/v1/inventory/productsPOST /api/v1/inventory/itemswith the product_idproduct_nameis null in the responseExpected
product_nameshould be populated with the product name in the create response (same as GET responses).Actual
Root cause
store.add_inventory_itemusesINSERT ... RETURNING *which only returnsinventory_itemscolumns — no JOIN toproducts. The GET endpoints (get_inventory_item,list_inventory) both JOIN to products and returnproduct_namecorrectly.Fix
After the insert, call
get_inventory_item(item["id"])to return the joined row, or do a follow-up SELECT with JOIN.