Add related mutations (#43)

This commit is contained in:
Niklas Fondberg
2021-09-15 14:01:07 +02:00
committed by GitHub
parent 0a786d6754
commit c4915cb15f
4 changed files with 96 additions and 6 deletions
+19
View File
@@ -161,4 +161,23 @@ export const productMutationTypeDefs = {
);
return (<ProductAPI>dataSources.productApi).getProduct(productId);
},
async addRelatedProducts(_, { productId, articleNumbers }, { dataSources }) {
await (<ProductAPI>dataSources.productApi).addRelatedProducts(
productId,
articleNumbers,
);
return (<ProductAPI>dataSources.productApi).getProduct(productId);
},
async removeRelatedProducts(
_,
{ productId, relatedProductIds },
{ dataSources },
) {
await (<ProductAPI>dataSources.productApi).removeRelatedProducts(
productId,
relatedProductIds,
);
return (<ProductAPI>dataSources.productApi).getProduct(productId);
},
};