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