Book type with id, title, and author fieldsdeleteBook mutation that accepts an id argument of type ID!id and titleBook type with id, title, and author fieldsdeleteBook mutation that accepts an id argument of type ID!id and titletype Book with fields id (ID!), title (String!), and author (String!). Also, create an array called books with these exact entries: { id: "1", title: "1984", author: "George Orwell" }, { id: "2", title: "Brave New World", author: "Aldous Huxley" }, and { id: "3", title: "Fahrenheit 451", author: "Ray Bradbury" }.Use the type keyword to define the Book type. Create a JavaScript array named books with the exact book objects.
type Mutation to the GraphQL schema with a deleteBook mutation. It should accept an id argument of type ID! and return a Book.Define a Mutation type with a deleteBook field that takes id: ID! and returns a Book.
resolvers object with a Mutation field. Implement the deleteBook resolver that takes parent, args, and removes the book with the matching id from the books array. Return the deleted book object.Use findIndex to locate the book by id. Use splice to remove it and return the removed book.
typeDefs and resolvers objects using module.exports so they can be used to create the GraphQL server.Use module.exports to export both typeDefs and resolvers.
What is the main purpose of a delete mutation in GraphQL?
Which of the following is the correct syntax for a GraphQL delete mutation to remove a user by ID?
mutation {
deleteUser(id: "123") {
success
message
}
}id: "123".Given the following delete mutation and response, what is the value of success?
mutation {
deletePost(id: "abc") {
success
message
}
}Response:
{
"data": {
"deletePost": {
"success": true,
"message": "Post deleted successfully"
}
}
}success field inside deletePost as true.true value means the deletion was successful.Identify the error in this delete mutation:
mutation {
deleteComment(commentId: 456) {
success
message
}
}commentId is likely a string and should be enclosed in quotes: "456".You want to delete multiple users by their IDs in one mutation call. Which approach correctly applies the delete mutation pattern?
Options:
Pass the test and this pattern moves unknown