Add sending of cache invalidation events for several product edits (#177)
This commit is contained in:
@@ -310,6 +310,7 @@ export const productMutationTypeDefs = {
|
||||
productId,
|
||||
markets,
|
||||
);
|
||||
await sendProductUpdatedEvent([productId], ['blacklisting']);
|
||||
return (<ProductAPI>dataSources.productApi).getProduct(productId);
|
||||
},
|
||||
|
||||
@@ -365,6 +366,7 @@ export const productMutationTypeDefs = {
|
||||
groupId,
|
||||
uris,
|
||||
);
|
||||
await sendProductUpdatedEvent([productId], ['interiors']);
|
||||
return (<ProductAPI>dataSources.productApi).getProduct(productId);
|
||||
},
|
||||
|
||||
@@ -420,9 +422,11 @@ export const productMutationTypeDefs = {
|
||||
{ printId, widthMm, heightMm, cropX, cropY, border },
|
||||
{ dataSources },
|
||||
): Promise<PrintProductDefaults> {
|
||||
return (<PrintProductDefaultsAPI>(
|
||||
const defaults = await (<PrintProductDefaultsAPI>(
|
||||
dataSources.printProductDefaultsApi
|
||||
)).updateDefaults(printId, widthMm, heightMm, cropX, cropY, border);
|
||||
await sendProductUpdatedEvent([printId], ['print-defaults']);
|
||||
return defaults;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -469,6 +473,8 @@ export const productMutationTypeDefs = {
|
||||
height.toString(),
|
||||
);
|
||||
|
||||
await sendProductUpdatedEvent([productId], ['product']);
|
||||
|
||||
const product = await (<ProductAPI>dataSources.productApi).getProduct(
|
||||
productId,
|
||||
);
|
||||
@@ -488,6 +494,7 @@ export const productMutationTypeDefs = {
|
||||
productId,
|
||||
articleNumbers,
|
||||
);
|
||||
await sendProductUpdatedEvent([productId], ['add-related-products']);
|
||||
return (<ProductAPI>dataSources.productApi).getProduct(productId);
|
||||
},
|
||||
|
||||
@@ -504,6 +511,10 @@ export const productMutationTypeDefs = {
|
||||
productId,
|
||||
relatedProductIds,
|
||||
);
|
||||
await sendProductUpdatedEvent(
|
||||
[productId, ...relatedProductIds],
|
||||
['remove-related-products'],
|
||||
);
|
||||
return (<ProductAPI>dataSources.productApi).getProduct(productId);
|
||||
},
|
||||
|
||||
@@ -574,6 +585,7 @@ export const productMutationTypeDefs = {
|
||||
productIds,
|
||||
markets,
|
||||
);
|
||||
await sendProductUpdatedEvent(productIds, ['blacklisting']);
|
||||
return {
|
||||
value: 'OK',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user