GraphQL Customr Resolver with multiple inputs

Hi community,

I am rather new to Realm and am playing around with it a bit. I am currently trying to build a small hobby project with a react frontend. The idea is to get a simple app I can use to track my personal projects :slight_smile:

I am currently struggling with adding my own mutations to the graphql interface. To be precise, I would like to write a custom GraphQL mutation, that takes (at least) 2 arguments. From what I can see, with [custom resolvers] I can only define mutations/functions with 1 argument, call input, but not with multiple inputs.

Could you point me in the right direction?

PS: I thought about giving an example here, but the entry got too long and seemed to deviate too much from my actual problem :slight_smile:

Hi Tim!

You’re correct that you can only have one input argument but you can use that to pass multiple named arguments in an object.

For example, if I wanted to pass a name and an age then I could use the following object as the input:

  "name": "Bob",
  "age": 42

Hope this helps! Let me know if you have any questions :slight_smile:

Hi Nick,

thanks a lot for your answer. Is it on the backlog to create such a feature? I am asking, because from what i can see I cannot create analogous functions as the auto-generated mutations currently, e.g. updateOneProject(query: ProjectQueryInput, set: ProjectUpdateInput!): Project.

To continue with my current challenge: could I also use multiple generated types and how would I define that in the schema definition?
E.g. that I have use the three auto-generated types ProjectQueryInput, ProjectEstimationQueryInput and ProjectEstimationUpdateInput and create the schema for an input like:

  "projectQuery": {
    // content following the ProjectQueryInput schema
  "estimationQuery": {
    // content following the ProjectEstimationQueryInput schema
  "estimation": {
    // content following the ProjectEstimationUpdateInput schema

I guess it’s obvious, what I want to do with it, but I still write it down to make sure: Use the projectQuery to filter to the correct project, then use the estimationQuery to filter our the correct estimation within that project and finally update this estimation with the content in estimation. (And yes, I would put this into one query, not multiple :slight_smile: )

Finally, is there a better approach with Realm to get this job done instead of writing my own mutation/function? Maybe there is already an off-the-shelf functionality?

Thanks a lot,