0
Hello,
I have a mutation
in the GraphQL
(With Rails) and I want to perform a database update using this mutation
. When he finishes udpate, return the entire object as a response.
Come on.
I have a table Users in the database. Let’s say that in the table of this database I have the following fields:
ID | name | birthday | phone | email
And I want to change the name of one of his, so Mutation will be:
mutation {
updateUser(
id: 6,
name: "Usuário 02"
) {
name
}
}
After I pass the argument: value
(name: "User 02") I can tell you what fields I want in this answer mutation
.
My doubt is there.
I don’t want to pass any field as an answer but when that happens, I want all the fields in the table to be returned, that is, the complete object (For those who are in doubt, User is my object rsrs).
Is that even possible? Could you give me some guidance on how to do?
Please read and if you do not understand any part, I ask you to comment here below that I already draw the doubt :)
Grateful to all who help!
Worth reading: https://productionreadygraphql.com/blog/2019-10-24-why-you-cant-select-all-fields-on-a-type-in-graphql.
– Luiz Felipe