Skip to content

Commit

Permalink
workflow result fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
noubase committed Jan 23, 2025
1 parent 7f59786 commit 2060542
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { ProductCategoryDTO, ProductCategoryWorkflow } from "@medusajs/framework/types"
import {
ProductCategoryDTO,
ProductCategoryWorkflow,
} from "@medusajs/framework/types"
import { ProductCategoryWorkflowEvents } from "@medusajs/framework/utils"
import {
WorkflowData,
WorkflowResponse,
createHook,
createWorkflow,
transform,
createHook
WorkflowData,
WorkflowResponse,
} from "@medusajs/framework/workflows-sdk"
import { emitEventStep } from "../../common"
import { createProductCategoriesStep } from "../steps"
Expand All @@ -19,10 +22,10 @@ export const createProductCategoriesWorkflowId = "create-product-categories"
/**
* This workflow creates one or more product categories. It's used by the
* [Create Product Category Admin API Route](https://docs.medusajs.com/api/admin#product-categories_postproductcategories).
*
*
* You can use this workflow within your customizations or your own custom workflows, allowing you to
* create product categories within your custom flows.
*
*
* @example
* const { result } = await createProductCategoriesWorkflow(container)
* .run({
Expand All @@ -34,17 +37,16 @@ export const createProductCategoriesWorkflowId = "create-product-categories"
* ]
* }
* })
*
*
* @summary
*
*
* Create product categories.
*/
export const createProductCategoriesWorkflow = createWorkflow(
createProductCategoriesWorkflowId,
(
input: WorkflowData<ProductCategoryWorkflow.CreateProductCategoriesWorkflowInput>
): WorkflowResponse<CreateProductCategoriesWorkflowOutput> => {

) => {
const createdCategories = createProductCategoriesStep(input)

const productCategoryIdEvents = transform(
Expand All @@ -62,11 +64,11 @@ export const createProductCategoriesWorkflow = createWorkflow(
})

const categoriesCreated = createHook("categoriesCreated", {
categories: createdCategories
categories: createdCategories,
})

return new WorkflowResponse(createdCategories, {
hooks: [categoriesCreated]
hooks: [categoriesCreated],
})
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const updateProductCategoriesWorkflow = createWorkflow(
updateProductCategoriesWorkflowId,
(
input: WorkflowData<ProductCategoryWorkflow.UpdateProductCategoriesWorkflowInput>
): WorkflowResponse<UpdateProductCategoriesWorkflowOutput> => {
) => {
const updatedCategories = updateProductCategoriesStep(input)

const productCategoryIdEvents = transform(
Expand Down

0 comments on commit 2060542

Please sign in to comment.