Hi everyone.
I'm trying to create a custom field resolver resolver (yes, this time I'm actually talking about the @customResolver directive)
so in my typedefs I defined (among other stuff
type USER @exclude(operations: [CREATE, UPDATE, DELETE])
{
user_id: ID! @id(autogenerate:true) @readonly
lastName: String!
firstName: String!
dob: Date! # some @auth directive here
gender: GENDER! # => Enum : Undef / Male / Female
profileUpdateRequired: Boolean! @customResolver (requires: ["lastName", "firstName", "dob", "gender"])
member_of_club: [CLUB!]! @relationship (type: "MEMBER_OF", direction: OUT)
# And lots of other stuff
}
extend type USER @auth
(
rules:
[
{
operations: [READ],
allow: ${userAuthorizations.userRead}
# userAuthorizations.userRead = '{ user_id: "$jwt.user_id" }' (for the moment) from externally defined string
}
]
)
In my resolvers I have
const resolvers =
{
USER:
{
profileUpdateRequired (source)
{
return source.lastName==="" || source.firstName==="" || source.dob==="0001-01-01" ||
(source.gender!=="Male" && source.gender!=="Female")
}
},
Query:
{
// ...userResolvers.Query
},
Mutation:
{
...userResolvers.Mutation
},
Subscription:
{
// ...userResolvers.Subscription
},
}
results in this error
C:\Users\Surface\Insync\ankou29666@gmail.com\Google Drive\dev\serveur\graphql\node_modules\@neo4j\graphql\dist\schema\get-custom-resolver-meta.js:46
throw new Error(`Custom resolver for ${field.name.value} has not been provided`);
^
Error: Custom resolver for profileUpdateRequired has not been provided
I have compared again and again and again with the example from the documentation but this still doesn't work and I don't understand what I'm missing. However I'm surprised by ${field.name.value} within a backtick quote.
Any idea ?
Thanks for your help