Closed maraisr closed 2 years ago
With a
const query = t.queryType({ ... }); const queryable = t.interfaceType({ name: "Queryable", fields: () => [ t.abstractField({ name: "query", type: t.NonNull(query), }), ], });
how do I define a resolver for:
const mutationPayload = t.objectType({ name: 'MyMutationPayload', interfaces: [queryable], fields: () => [ t.field({ name: 'query', type: t.NonNull(query) }) ] }); const MyMutation = t.field({ name: "MyMutation", type: mutationPayload, async resolve(src, args, ctx) { // .. stuff return { /* do I need to put query here somehow? */ } } }) t.mutationType({ fields: () => [MyMutation], })
mutation DoThing { MyMutation { query { hello # 👈 get this resolved from the root. } } }
With a
how do I define a resolver for:
Usecase