@update

Updating one or more Lucid models

For a separate add use

/* ... */
const {
  UpdateDirective,
  UpdateTypeDefs
} = require('apollo-server-adonis-directives-pack/src/directives/mutation/Update')

makeExecutableSchema({ 
  /* ... */ 
  typeDefs: [ UpdateTypeDefs, /* ... */ ],
  schemaDirectives: { UpdateDirective, /* ... */} 
})

Definition

UpdateTypeDefs
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

Update directive updates by primary key of model

Example

input UpdatePostInput {
    name: String
    text: String!
}

type Mutation {
    updatePost(id: String!, input: UpdatePostInput! ): Post @update
    updateManyPost(id: [String!]!, input: UpdatePostInput!): [Post] @update
}

Last updated

Was this helpful?