// cross-sell.graphql.ts export const crossSellQueryTypeDefinitions = ` crossSell(crossSellId: Int): CrossSell productCrossSells(productId: String): [CrossSell!] `; export const crossSellTypeDefinitions = ` type CrossSell { displaysProductPrice: Boolean displaysProductTitle: Boolean id: Int productId: String shopId: Int title: String type: String typeValue: String customCrossSellProductIds: [String!] } } `; export const buildCrossSellQueryResolvers = () => { return { crossSell: async ( _: any, args: { crossSellId: number }, ctx: AppContext, ): Promise => { const { crossSellId } = args; const crossSell = (await ctx.state.dataLoaders.crossSell .load(crossSellId) .catch(error => { logError(error, ERROR_MESSAGE.CROSS_SELL_FETCH_FAILED, ctx); ctx.throw(500, getStatusText(500)); })) as CrossSell; return crossSell; }, export const buildCrossSellResolvers = () => { return { CrossSell: { id: async ( root: CrossSell, args: any, ctx: AppContext, ): Promise => { return root.id; }, shopId: async ( root: CrossSell, args: any, ctx: AppContext, ): Promise => { return root.shopId; },