docs: fix examples in workflows reference (#11688)

This commit is contained in:
Shahed Nasser
2025-03-03 12:20:40 +02:00
committed by GitHub
parent 61a0e4f3cf
commit 82bcdc6271
4 changed files with 922 additions and 920 deletions

View File

@@ -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])
}
)
```

View File

@@ -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))
}
)

View File

@@ -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