26 lines
809 B
TypeScript
26 lines
809 B
TypeScript
import { IResolverObject } from 'graphql-tools';
|
|
import { DesignerAPI } from '../datasources/designer-api';
|
|
import { OrderAPI } from '../datasources/order-api';
|
|
import { GeneralInput } from '../types/types';
|
|
|
|
const Designer: IResolverObject = {
|
|
async orderRows({ id }, input: GeneralInput, { dataSources }) {
|
|
return (<OrderAPI>dataSources.orderApi).getOrderRowsByDesignerId(id, input);
|
|
},
|
|
};
|
|
|
|
async function getDesigners(_, { limit }, { dataSources }) {
|
|
return (<DesignerAPI>dataSources.designerApi).getDesigners(limit);
|
|
}
|
|
|
|
async function getDesigner(parent, { id }, { dataSources }) {
|
|
return (<DesignerAPI>dataSources.designerApi).getDesignerById(id);
|
|
}
|
|
|
|
export const designerTypeDefs = { Designer };
|
|
|
|
export const designerQueryTypeDefs = {
|
|
designers: getDesigners,
|
|
designer: getDesigner,
|
|
};
|