Skip to main content
Approves products awaiting review: validates every product is in proposed status, sets them to published, and records a confirmed STATUS_CHANGE audit action per product. Triggered by POST /admin/products/:id/confirm. Emits product.published with one { id, internal_note } entry per product.

Usage

import { confirmProductsWorkflow } from "@mercurjs/core/workflows"

await confirmProductsWorkflow(container).run({
  input: {
    product_ids: ["prod_01H..."],
    actor_id: "user_01H...",
    internal_note: "Approved after review",
  },
})

Input

product_ids
string[]
required
Ids of the products to publish. Every product must currently be in proposed status.
actor_id
string
Actor id recorded on the audit trail entry.
internal_note
string
Operator-only note stored on the audit change and included in the emitted event.

Result

result
void
Returns nothing; the products are updated in place.

Hooks

productsConfirmed
hook
Runs after publishing with { product_ids, internal_note }.