UI Handoff: Curated Product Copy Flow (Inventory Item Create)
Date: 2026-03-06
Audience: React Native developers + QA
Endpoint
POST /api/inventory-items/
Request Body (current schema)
{
"inventory_id": 1,
"storage_box_id": 1,
"product_id": 123,
"current_quantity": 5,
"min_stock": 1,
"lot_number": "LOT-001",
"expiration_date": "2026-12-31",
"notes": "Batch notes"
}
min_stock is the preferred field for UI requests. It is stored in the inventory/storage-box/product stock-alert mapping. minimum_quantity is still accepted by the backend for backward compatibility.
Required fields:
inventory_idstorage_box_idproduct_id
New Behavior
If product_id belongs to another user (curator product) and current user has access via curated list:
- Backend copies that product to current user.
- Copied product is set to
managing_status = "both". - Inventory item is created using copied product id.
If product_id is already owned by current user:
- No copy is created.
- Inventory item uses same product id.
Response Notes
Response shape is unchanged, but nested product values may differ:
product.idcan be a new copied id (for curated source products).product.managing_statusmay be"both".product.created_by.idshould be current user for copied products.
Example Response: own product (no copy)
{
"id": 11,
"inventory": { "id": 1, "name": "Main Inventory" },
"storage_box": { "id": 1, "name": "Main Box" },
"product": {
"id": 21,
"managing_status": "self_managed",
"created_by": { "id": 5, "email": "user@example.com" }
},
"current_quantity": 5,
"min_stock": 1,
"minimum_quantity": 1,
"lot_number": "LOT-001"
}
Example Response: curated product (copied)
{
"id": 12,
"inventory": { "id": 1, "name": "Main Inventory" },
"storage_box": { "id": 1, "name": "Main Box" },
"product": {
"id": 45,
"managing_status": "both",
"created_by": { "id": 5, "email": "user@example.com" }
},
"current_quantity": 5,
"min_stock": 1,
"minimum_quantity": 1,
"lot_number": "LOT-002"
}
React Native Checklist
- Always send
Authorization: Bearer <access_token>. - Send
inventory_id,storage_box_id,product_id(not old keysinventory,storage_box,product). - Prefer sending
min_stock; backend still acceptsminimum_quantity. - The persisted threshold now lives in
/api/inventory-stock-alerts/for theinventory_id + storage_box_id + product_idcombination. - After create, use returned nested
product.idfor next actions. - Treat
managing_statusenum as:catalogued | self_managed | both. - If create fails with
400, verify user access to inventory/storage box/product.
QA Test Cases
- Own product -> item created with same
product.id. - Curated subscribed product -> item created with copied
product.id,managing_status=both. - Repeat curated add -> should reuse existing copied product (no unnecessary duplicate copy).
- Expired/inactive curated subscription ->
product_idshould be rejected.
Swagger / API Docs
- UI can verify live schema at
/api/docs/. - Inventory item create description now documents the curated-copy behavior.