Cannot find subcircuit for root field

I am using a package graphql-toolsand 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 getOrdersByDatesin userInfoResolveras 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 getOrdersByDatesand paste it into my request UserInfo?

Any help would be appreciated.

+4
source share

Source: https://habr.com/ru/post/1691038/


All Articles