I am using a package graphql-tools
and I am trying to stitch a subquery into the resolver of another object.
The request I would like to stitch:
ordersQueries: {
getOrdersByDates(startDate, endDate): [Order]
......
}
I would like to stitch getOrdersByDates
in userInfoResolver
as follows:
export const userInfoResolver = (mergeInfo) => ({
UserInfo:{
orders: {
fragment: `...`
resolve(parent, args, context, info) {
...
return mergeInfo.delegate(
'query',
'getOrdersByDates'
);
}
}
}
});
But I can not, because it is not defined in the root requests of the microservice.
So, I tried this:
export const userInfoResolver = (mergeInfo) => ({
UserInfo:{
orders: {
fragment: `...`
resolve(parent, args, context, info) {
...
return mergeInfo.delegate(
'query',
'ordersQueries.getOrdersByDates'
);
}
}
}
});
But the result:
"Cannot find subschema for root field "query.ordersQueries.getOrdersByDates".
So how can I access the subquery getOrdersByDates
and paste it into my request UserInfo
?
Any help would be appreciated.
source
share