Added designers

This commit is contained in:
Niklas Fondberg
2021-04-08 23:11:24 +02:00
parent 2b57afbc4a
commit 3c648cee29
18 changed files with 366 additions and 151 deletions
+13 -4
View File
@@ -1,24 +1,33 @@
// (parent, args, ctx, info)
import { IResolverObject } from 'graphql-tools';
import { OrderAPI } from '../datasources/order-api';
import { ProductAPI } from '../datasources/product-api';
const ProductBlacklist: IResolverObject = {
async market(parent, args, { dataSources }) {
return dataSources.orderApi.getMarketById(parent.marketId);
return (<OrderAPI>dataSources.orderApi).getMarketById(parent.marketId);
},
};
const Product: IResolverObject = {
async categories({ id }, args, { dataSources }) {
return dataSources.productApi.getCategories(id);
return (<ProductAPI>dataSources.productApi).getCategories(id);
},
async designer({ designerId }, args, { dataSources }) {
return dataSources.designerApi.getDesignerById(designerId);
},
};
async function getProducts(_, { limit, visible, browsable }, { dataSources }) {
return dataSources.productApi.getProducts(limit, visible, browsable);
return (<ProductAPI>dataSources.productApi).getProducts(
limit,
visible,
browsable,
);
}
async function getProduct(_, { id }, { dataSources }) {
return dataSources.productApi.getProduct(id);
return (<ProductAPI>dataSources.productApi).getProduct(id);
}
export const productTypeDefs = {