From 20605427a47eb459640d009cc6f30992f9dfa163 Mon Sep 17 00:00:00 2001 From: Roman Shuper Date: Thu, 23 Jan 2025 13:40:38 +0200 Subject: [PATCH] workflow result fixed --- .../workflows/create-product-categories.ts | 26 ++++++++++--------- .../workflows/update-product-categories.ts | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/core/core-flows/src/product-category/workflows/create-product-categories.ts b/packages/core/core-flows/src/product-category/workflows/create-product-categories.ts index 42e75182b9267..fabd95eb8bba0 100644 --- a/packages/core/core-flows/src/product-category/workflows/create-product-categories.ts +++ b/packages/core/core-flows/src/product-category/workflows/create-product-categories.ts @@ -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" @@ -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({ @@ -34,17 +37,16 @@ export const createProductCategoriesWorkflowId = "create-product-categories" * ] * } * }) - * + * * @summary - * + * * Create product categories. */ export const createProductCategoriesWorkflow = createWorkflow( createProductCategoriesWorkflowId, ( input: WorkflowData - ): WorkflowResponse => { - + ) => { const createdCategories = createProductCategoriesStep(input) const productCategoryIdEvents = transform( @@ -62,11 +64,11 @@ export const createProductCategoriesWorkflow = createWorkflow( }) const categoriesCreated = createHook("categoriesCreated", { - categories: createdCategories + categories: createdCategories, }) return new WorkflowResponse(createdCategories, { - hooks: [categoriesCreated] + hooks: [categoriesCreated], }) } ) diff --git a/packages/core/core-flows/src/product-category/workflows/update-product-categories.ts b/packages/core/core-flows/src/product-category/workflows/update-product-categories.ts index 5728d454c2254..ac520774164fd 100644 --- a/packages/core/core-flows/src/product-category/workflows/update-product-categories.ts +++ b/packages/core/core-flows/src/product-category/workflows/update-product-categories.ts @@ -44,7 +44,7 @@ export const updateProductCategoriesWorkflow = createWorkflow( updateProductCategoriesWorkflowId, ( input: WorkflowData - ): WorkflowResponse => { + ) => { const updatedCategories = updateProductCategoriesStep(input) const productCategoryIdEvents = transform(