Merge pull request #46 from Photowall/148-add-mutations-for-categories

This commit is contained in:
Anders Gustafsson
2021-09-17 08:31:30 +02:00
committed by GitHub
3 changed files with 51 additions and 0 deletions
+20
View File
@@ -222,4 +222,24 @@ export const productMutationTypeDefs = {
);
return (<ProductAPI>dataSources.productApi).getProduct(productId);
},
async addCategoriesToProduct(_, { productId, categoryIds }, { dataSources }) {
await (<ProductAPI>dataSources.productApi).addCategoriesToProduct(
productId,
categoryIds,
);
return (<ProductAPI>dataSources.productApi).getProduct(productId);
},
async removeCategoriesFromProduct(
_,
{ productId, categoryIds },
{ dataSources },
) {
await (<ProductAPI>dataSources.productApi).removeCategoriesFromProduct(
productId,
categoryIds,
);
return (<ProductAPI>dataSources.productApi).getProduct(productId);
},
};