fix: Fixes to product module and improving tests (#6898)

This commit is contained in:
Stevche Radevski
2024-04-02 09:13:46 +02:00
committed by GitHub
parent b2763647f7
commit b3ce13d61e
8 changed files with 133 additions and 251 deletions

View File

@@ -58,7 +58,7 @@ export const updateProductVariantsWorkflow = createWorkflow(
return {
selector: {
ids: data.variantPriceSetLinks.map((link) => link.price_set_id),
id: data.variantPriceSetLinks.map((link) => link.price_set_id),
} as PricingTypes.FilterablePriceSetProps,
update: {
prices: data.input.update.prices,
@@ -78,11 +78,11 @@ export const updateProductVariantsWorkflow = createWorkflow(
},
(data) => {
return data.updatedVariants.map((variant, i) => {
const linkForVariant = data.variantPriceSetLinks.find(
const linkForVariant = data.variantPriceSetLinks?.find(
(link) => link.variant_id === variant.id
)
const priceSetForVariant = data.updatedPriceSets.find(
const priceSetForVariant = data.updatedPriceSets?.find(
(priceSet) => priceSet.id === linkForVariant?.price_set_id
)

View File

@@ -15,6 +15,7 @@ export const updateProductsWorkflow = createWorkflow(
(
input: WorkflowData<WorkflowInput>
): WorkflowData<ProductTypes.ProductDTO[]> => {
// TODO: Delete price sets for removed variants
return updateProductsStep(input)
}
)