Edit item modal: purchase_date change is silently discarded #104
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#104
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
The Edit Item modal has a Purchase Date field that accepts user input, but the PATCH request sends
purchase_datewhich is not in theInventoryItemUpdateschema. Pydantic silently discards it, so purchase date changes never persist.Steps to reproduce
Expected
The purchase date is saved and displayed on the item.
Actual
The PATCH request includes
purchase_datein the body, butInventoryItemUpdate(Pydantic schema) does not declare this field. Pydantic v2 ignores unknown fields by default. The backend never receives the value.Root cause
frontend/src/components/EditItemModal.vueline 177 constructsupdate.purchase_date = ...and sends it toPATCH /api/v1/inventory/items/{id}. Butapp/models/schemas/inventory.py InventoryItemUpdatedoes not includepurchase_date, andstore.update_inventory_item()does not include it in itsallowedset either.Fix
Add
purchase_date: Optional[date] = NonetoInventoryItemUpdateand add"purchase_date"to theallowedset instore.update_inventory_item().