Fix/add additionl data to product categories hook (#11226)

* fix: add additional_data to categoriesCreated hooks

* fix: restore yarn.lock

* fix: add additional_data param in the http validators

* fix: add additional_data to updateProductCategoriesWorkflow

* Update yarn.lock

* fix: fix merge

* fix: refert yarn.lock

* fix: revert tarn.lock

* Create clean-poets-promise.md

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
This commit is contained in:
BOUAZZA Ayyoub
2025-02-26 14:58:01 +01:00
committed by GitHub
co-authored by Carlos R. L. Rodrigues Riqwan Thamir
parent 95eef899f7
commit 93cbc6b669
5 changed files with 38 additions and 16 deletions
@@ -65,6 +65,7 @@ export const createProductCategoriesWorkflow = createWorkflow(
const categoriesCreated = createHook("categoriesCreated", {
categories: createdCategories,
additional_data: input.additional_data,
})
return new WorkflowResponse(createdCategories, {
@@ -1,4 +1,7 @@
import { ProductCategoryDTO, ProductCategoryWorkflow } from "@medusajs/framework/types"
import {
ProductCategoryDTO,
ProductCategoryWorkflow,
} from "@medusajs/framework/types"
import { ProductCategoryWorkflowEvents } from "@medusajs/framework/utils"
import {
WorkflowData,
@@ -19,10 +22,10 @@ export const updateProductCategoriesWorkflowId = "update-product-categories"
/**
* This workflow updates product categories matching specified filters. It's used by the
* [Update Product Category Admin API Route](https://docs.medusajs.com/api/admin#product-categories_postproductcategoriesid).
*
*
* You can use this workflow within your customizations or your own custom workflows, allowing you to
* update product categories within your custom flows.
*
*
* @example
* const { result } = await updateProductCategoriesWorkflow(container)
* .run({
@@ -35,16 +38,16 @@ export const updateProductCategoriesWorkflowId = "update-product-categories"
* }
* }
* })
*
*
* @summary
*
*
* Update product categories.
*/
export const updateProductCategoriesWorkflow = createWorkflow(
updateProductCategoriesWorkflowId,
(
input: WorkflowData<ProductCategoryWorkflow.UpdateProductCategoriesWorkflowInput>
) => {
) => {
const updatedCategories = updateProductCategoriesStep(input)
const productCategoryIdEvents = transform(
@@ -66,11 +69,12 @@ export const updateProductCategoriesWorkflow = createWorkflow(
})
const categoriesUpdated = createHook("categoriesUpdated", {
categories: updatedCategories
categories: updatedCategories,
additional_data: input.additional_data,
})
return new WorkflowResponse(updatedCategories, {
hooks: [categoriesUpdated]
hooks: [categoriesUpdated],
})
}
)