GraphQL Type Parent Resolver in Cloud Code

Hi
I’like to ask how can I possibly create child type resolver using cloud code?
The equivalent of:

const resolvers = {

Book: {
  author: async (parent) => {
      // get User
  }
}

Query: {
   books: async ()=>{
       // get Books
     }
  }

}

Many thanks

Have you tried something like this?

Yes, I have. But how you get the parent object? In order to get its properties in cloud function definition? i.e.

type Parent  {

child: Child @resolve

}

Parse.cloud.define('child', async (params)=>{
??? parentId
}

I believe that’s currently not possible and I understand that it is a huge limitation. Would you mind to open an issue in the parse-server repo? We can work on that.

You can get the full parent object using a GraphQL Js schema merged with the auto generated schema. Currently parse resolve directive seems to do not support parent object.

If you want to customize the api, I suggest you to switch to the GraphQL Js schema way :slight_smile:

You can find some example in Parse Server GraphQL tests at the end of the file.