I am having problems trying to resolve fields inside a GraphQL type.
So, here I am trying to resolve the find
property of patientQuery
const gqlSchema = makeExecutableSchema({
typeDefs: `
type patientQuery {
find: [String]
findOne: String
}
type Query {
patient: patientQuery
}
type Mutation {
addPost(name: String, title: String, content: String): patientQuery
}
schema {
query: Query
mutation: Mutation
}
`,
resolvers: {
patientQuery: {
find(root, params, context, ast) {
console.log('testing');
return ['title'];
}
}
}
});
but when I do a query like this
{
patient {
find
}
}
I always get null
{
"data": {
"patient": null
}
}
So what is the proper way to resolve the fields inside the patientQuery
type?