docs: change event payload handling in subscribers (#8078)

This commit is contained in:
Shahed Nasser
2024-07-11 13:34:24 +03:00
committed by GitHub
parent 143847ace4
commit 02add3f0f5
8 changed files with 33 additions and 11 deletions
@@ -51,7 +51,7 @@ export default async function productCreateHandler({
to: "shahednasser@gmail.com",
channel: "email",
template: "product-created",
data: "data" in data ? data.data : data,
data: data.data,
})
}
@@ -145,7 +145,7 @@ export default async function productCreateHandler({
to: "test@gmail.com",
channel: "email",
template: "product-created",
data: "data" in data ? data.data : data,
data: data.data,
})
}
@@ -291,7 +291,7 @@ export const subscriberHighlights = [
Modules.NOTIFICATION
)
const inventoryItemId = "data" in data ? data.data.id : data.id
const inventoryItemId = data.data.id
const inventoryVariantLinkService = remoteLink.getLinkModule(
Modules.PRODUCT,
@@ -798,7 +798,7 @@ The `order.placed` event is currently not emitted.
data,
container,
}: SubscriberArgs<{ id: string }>) {
const orderId = "data" in data ? data.data.id : data.id
const orderId = data.data.id
const orderModuleService: IOrderModuleService = container
.resolve(ModuleRegistrationName.ORDER)
@@ -1126,7 +1126,7 @@ In the subscriber, you can send a notification, such as an email, to the custome
"digitalProductModuleService"
)
const orderId = "data" in data ? data.data.id : data.id
const orderId = data.data.id
const order = await orderModuleService.retrieveOrder(orderId, {
relations: ["items"],
@@ -269,7 +269,7 @@ export const workflowHighlights = [
createProductWorkflow(container)
.run({
input: {
productId: "data" in data ? data.data.id : data.id
productId: data.data.id
}
})
.then(() => {