Added orderrows
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import orders, { ContactInformation } from './orders-resolver';
|
||||
import orders, { ContactInformation, Order } from './orders-resolver';
|
||||
import products from './products-resolver';
|
||||
import { DateTimeScalar } from './datetime-type';
|
||||
|
||||
@@ -6,6 +6,7 @@ const resolvers = {
|
||||
Query: { ...orders, ...products },
|
||||
DateTime: DateTimeScalar,
|
||||
ContactInformation,
|
||||
Order,
|
||||
};
|
||||
|
||||
export default resolvers;
|
||||
|
||||
@@ -7,6 +7,12 @@ export const ContactInformation: IResolverObject = {
|
||||
},
|
||||
};
|
||||
|
||||
export const Order: IResolverObject = {
|
||||
async rows({ id }, args, { dataSources }) {
|
||||
return dataSources.orderApi.getOrderRows(id);
|
||||
},
|
||||
};
|
||||
|
||||
async function getOrders(_, __, { dataSources }) {
|
||||
return dataSources.orderApi.getOrders();
|
||||
}
|
||||
@@ -17,7 +23,7 @@ async function getOrder(_, { id }, { dataSources }) {
|
||||
|
||||
const orders = {
|
||||
orders: getOrders,
|
||||
order: () => getOrder,
|
||||
order: getOrder,
|
||||
};
|
||||
|
||||
export default orders;
|
||||
|
||||
Reference in New Issue
Block a user