Files
graphql-api-js/src/resolvers/orders-resolver.ts
T
2021-04-07 18:30:56 +02:00

24 lines
542 B
TypeScript

import { IResolverObject } from 'graphql-tools';
export const ContactInformation: IResolverObject = {
// (parent, args, ctx, info)
async address({ addressId }, args, { dataSources }) {
return dataSources.orderApi.getAddress(addressId);
},
};
async function getOrders(_, __, { dataSources }) {
return dataSources.orderApi.getOrders();
}
async function getOrder(_, { id }, { dataSources }) {
return dataSources.orderApi.getOrder(id);
}
const orders = {
orders: getOrders,
order: () => getOrder,
};
export default orders;