20: printproduct group mutation (#21)

* Finished the mutation for productGroups

* Fixes after CR

* added enums for typeid
This commit is contained in:
Arwid Thornström
2021-09-03 15:11:06 +02:00
committed by GitHub
parent a4b847c7be
commit 8d83205747
5 changed files with 146 additions and 1 deletions
+8
View File
@@ -1,6 +1,7 @@
import { ProductAPI } from '../datasources/product-api';
import {
Product,
ProductGroup,
ProductListResult,
ProductsFilterInput,
} from '../types/product-types';
@@ -94,6 +95,13 @@ export const productMutationTypeDefs = {
);
return (<ProductAPI>dataSources.productApi).getProduct(productId);
},
async productGroup(_, { productId, groupIds }, { dataSources }) {
await (<ProductAPI>dataSources.productApi).updateGroups(
productId,
groupIds,
);
return (<ProductAPI>dataSources.productApi).getProduct(productId);
},
async productKeywords(_, { productId, keywordIds }, { dataSources }) {
await (<KeywordAPI>dataSources.keywordApi).setProductKeywords(
productId,