In my last post we learned how to integrate GraphQL into Rails project and write first queries to retrieve data from backend.
Now let’s see how we can add, update and destroy entries.
We have new task_type.rb file:
Let’s create mutation_type.rb file. And describe our new Mutations.
And add new QueryType:
Also, add Input object - for us, it’s a simple thing, which should describe input params for our queries.
And finally our TaskMutations module, where we describe input fields, queries, input and return parameters.
Let’s play with GraphQL console: