Updating one or more Lucid models
Required arguments for writing a mutation:
id - Int! / [Int!]! / String! / [String!]! / ID! / [ID!]!
input - type Input or type Input (array)
/* ... */ const { UpdateDirective, UpdateTypeDefs } = require('apollo-server-adonis-directives-pack/src/directives/mutation/Update') makeExecutableSchema({ /* ... */ typeDefs: [ UpdateTypeDefs, /* ... */ ], schemaDirectives: { UpdateDirective, /* ... */} })
directive @update( # By default, the model will be calculated from the name # of the returned "type" with the prefix 'App/Model/' model: String) on FIELD_DEFINITION
If you assign a different set to the input and output, this will throw an exception
Update directive updates by primary key of model
input UpdatePostInput { name: String text: String! } type Mutation { updatePost(id: String!, input: UpdatePostInput! ): Post @update updateManyPost(id: [String!]!, input: UpdatePostInput!): [Post] @update }
Last updated 4 years ago
Was this helpful?
Carefully describe the mutation!
Error: Different sets are installed for input and output.