You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had to check the source code to figure out how create custom mutations, it would be very helpful include better explanation on the docs.
It would be good mentioning that custom queries and mutations should be included in sequelize models definitions, then provide an example like this.
constuser=sequelizeClient.define('user',{email: {type: Sequelize.STRING,allowNull: true,unique: false,},password: {type: Sequelize.STRING,allowNull: true,}},{classMethods: {//queries: function(){},mutations: function(Models,ModelTypes,resolver){console.log("Creating custom mutations for model user");return{myMutationA: {type: MyCustomType,args: {dataA: {data: 'dataA',type: newGraphQLNonNull(GraphQLString)},dataB: {data: 'dataB',type: newGraphQLNonNull(GraphQLString)}},resolve: (obj,{
name
})=>{console.log("Calling custom mutator with data")console.log(name)// Here call sequelize using Models in the scopeletmyFirstPromise=newPromise((resolve,reject)=>{setTimeout(function(){resolve("Success!");},250);});returnmyFirstPromise;}}};}}});
The text was updated successfully, but these errors were encountered:
I had to check the source code to figure out how create custom mutations, it would be very helpful include better explanation on the docs.
It would be good mentioning that custom queries and mutations should be included in sequelize models definitions, then provide an example like this.
The text was updated successfully, but these errors were encountered: