From 45c1767c6a3eefd024c67b376ec9971fda43cc6a Mon Sep 17 00:00:00 2001 From: Chris Kalmar Date: Sat, 30 Jan 2021 12:02:29 +0100 Subject: [PATCH] apply new object params when using mutation resolver --- src/graphqlProtocol/mutation.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/graphqlProtocol/mutation.ts b/src/graphqlProtocol/mutation.ts index d126e173..760f7f4b 100644 --- a/src/graphqlProtocol/mutation.ts +++ b/src/graphqlProtocol/mutation.ts @@ -69,19 +69,19 @@ export const generateMutations = (graphRegistry) => { type: new GraphQLNonNull(mutationInputType), }, }, - resolve: getMutationResolver( + resolve: getMutationResolver({ entity, entityMutation, typeName, - false, - ({ args }) => { + nested: false, + idResolver: ({ args }) => { return extractIdFromNodeId( graphRegistry, entity.name, args.input.nodeId, ); }, - ), + }), }; if (entityMutation.isTypeCreate || entityMutation.isTypeUpdate) { @@ -115,19 +115,19 @@ export const generateMutations = (graphRegistry) => { type: new GraphQLNonNull(mutationInputNestedType), }, }, - resolve: getMutationResolver( + resolve: getMutationResolver({ entity, entityMutation, typeName, - true, - ({ args }) => { + nested: true, + idResolver: ({ args }) => { return extractIdFromNodeId( graphRegistry, entity.name, args.input.nodeId, ); }, - ), + }), }; } @@ -162,15 +162,15 @@ export const generateMutations = (graphRegistry) => { type: new GraphQLNonNull(mutationByPrimaryAttributeInputType), }, }, - resolve: getMutationResolver( + resolve: getMutationResolver({ entity, entityMutation, typeName, - false, - ({ args }) => { + nested: false, + idResolver: ({ args }) => { return args.input[fieldName]; }, - ), + }), }; } }