docs: fix examples in workflows reference (#11688)
This commit is contained in:
@@ -27,12 +27,12 @@ export const createProductStep = createStep(
|
||||
"createProductStep",
|
||||
async function (
|
||||
input: CreateProductInput,
|
||||
context
|
||||
{ container }
|
||||
) {
|
||||
const productService = context.container.resolve(
|
||||
"productService"
|
||||
const productModuleService = container.resolve(
|
||||
"product"
|
||||
)
|
||||
const product = await productService.createProducts(input)
|
||||
const product = await productModuleService.createProducts(input)
|
||||
return new StepResponse({
|
||||
product
|
||||
}, {
|
||||
@@ -41,12 +41,15 @@ export const createProductStep = createStep(
|
||||
},
|
||||
async function (
|
||||
input,
|
||||
context
|
||||
{ container }
|
||||
) {
|
||||
const productService = context.container.resolve(
|
||||
"productService"
|
||||
if (!input) {
|
||||
return
|
||||
}
|
||||
const productModuleService = container.resolve(
|
||||
"product"
|
||||
)
|
||||
await productService.deleteProducts(input.product_id)
|
||||
await productModuleService.deleteProducts([input.product_id])
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
@@ -25,7 +25,6 @@ import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
import {
|
||||
createProductStep,
|
||||
getProductStep,
|
||||
createPricesStep
|
||||
} from "./steps"
|
||||
|
||||
interface WorkflowInput {
|
||||
@@ -39,7 +38,6 @@ const myWorkflow = createWorkflow(
|
||||
// during the execution. Including the data access.
|
||||
|
||||
const product = createProductStep(input)
|
||||
const prices = createPricesStep(product)
|
||||
return new WorkflowResponse(getProductStep(product.id))
|
||||
}
|
||||
)
|
||||
|
||||
@@ -21,7 +21,6 @@ import {
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
import {
|
||||
createProductStep,
|
||||
getProductStep,
|
||||
createPricesStep,
|
||||
attachProductToSalesChannelStep
|
||||
} from "./steps"
|
||||
@@ -40,8 +39,10 @@ const myWorkflow = createWorkflow(
|
||||
attachProductToSalesChannelStep(product)
|
||||
)
|
||||
|
||||
const id = product.id
|
||||
return new WorkflowResponse(getProductStep(product.id))
|
||||
return new WorkflowResponse({
|
||||
prices,
|
||||
productSalesChannel
|
||||
})
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user