AddProduct mutation (#59)
This commit is contained in:
@@ -84,6 +84,13 @@ export const productQueryTypeDefs = {
|
||||
///////////////////
|
||||
// Mutations below
|
||||
export const productMutationTypeDefs = {
|
||||
async addProduct(_, { name, batch }, { dataSources }) {
|
||||
const id = await (<ProductAPI>dataSources.productApi).addProduct(
|
||||
name,
|
||||
batch,
|
||||
);
|
||||
return (<ProductAPI>dataSources.productApi).getProduct(id);
|
||||
},
|
||||
async productInfo(_, { productId, info }, { dataSources }) {
|
||||
await (<ProductAPI>dataSources.productApi).updateProductInfo(
|
||||
productId,
|
||||
|
||||
Reference in New Issue
Block a user