-1
I am trying to return the value of a deletion in the api, with this value returned I will be able to do a treatment for the frontend but as I am beginner in this area, I’m having difficulties
I would like when I made the deletion to return 1 or 0 (value returned in console.log()) in response.
I’m using knex as query Builder+mariadb, the crud is working, but the custom response part I can’t do
follows a part of the code:
const users = `
id: ID
Nome: String
Celular: Float
CPF: Float
`
const typeDefs = `
type User {
${users}
}
type Mutation {
deletUser(id: ID!): User
}
`
Mutation: {
async deletUser(_, { id } ) {
const result = await db('CrudList').delete().where({ id })
console.log(result)
return await result
}
}
mutation{
deletUser(id: 4) {id}
}
Answer:
{
"data": {
"deletUser": {
"id": null
}
}
}
thanks since you