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