feat(workflows):product handlers should be reusable in different context (#4703)

**What**
The listProducts handler should not be specific to the workflow.
Same for the product removal, shouldn't expect an entire DTO but just a collection of object that at least contains the id.
Same principle applied to other product handlers
This commit is contained in:
Adrien de Peretti
2023-08-07 18:22:22 +02:00
committed by GitHub
parent b396168dfd
commit 8ae31aff4b
10 changed files with 66 additions and 41 deletions

View File

@@ -275,10 +275,16 @@ const handlers = new Map([
},
{
from: Actions.createProducts,
alias: ProductHandlers.listProducts.aliases.products,
alias: "products",
},
],
},
async ({ data }) => {
return {
alias: ProductHandlers.listProducts.aliases.ids,
value: data.products.map((product) => product.id),
}
},
aggregateData(),
ProductHandlers.listProducts
),