-1
Hello, world! I’m studying Graphql and I’m having a problem with this Mutation...
var schema = buildSchema('
type userAccount {
firstName: String!
lastName: String!
mobileNumber: String
email: String
password: String!
}
type Mutation {
createAccount(
firstName: String!,
lastName: String!,
mobileNumber: String,
email: String,
password: String!
): userAccount
}
');
var root = {
createAccount: ({firstName, lastName, mobileNumber, email, password}) => {
// AccountModel.create é um model do sequelize que registra os dados, isso funciona, mas a mutation retorna null
AccountModel.create({
firstName,
lastName,
mobileNumber,
email,
password
})
}
};
// Then in localhost:3000/graphiql I do Mutation and it returns null(I should return the account I just registered)
Behold this post from the Graphql documentation itself.
– Gustavo Sampaio
Ah, and in the original code,
buildSchema
, you put simple quotes ('
) or grave accent (```)?– Gustavo Sampaio
In the original code I used crases( ` )
– Gabriel Mendes