offer ↔ inventory_item link.
batchOfferInventoryItemsWorkflow applies creates, updates, and deletes to that
link in a single run.
Run the batch workflow
src/api/custom/offer-inventory/route.ts
created, updated, and deleted.
Rules the workflow enforces
- Items in
createmust not already be linked to the offer; items inupdateanddeletemust already be linked. - An
inventory_item_idcan’t appear in more than one section, and can’t be duplicated within a section. createitems must reference existingInventoryItemrecords;required_quantitydefaults to1.- Deleting an item that isn’t linked to the offer surfaces a 404 rather than silently no-op’ing.
This workflow manages the links between an offer and existing inventory
items and their
required_quantity. To create brand-new inventory items with
starting stock as part of listing an offer, pass inventory_items to
createOffersWorkflow instead.offer.updated and exposes an offerInventoryItemsBatched
hook carrying the offer_id, the batch result, and any additional_data you
passed in.