@create

Create a new Lucid model with the given arguments.

For a separate add use

/* ... */
const {
  CreateDirective,
  CreateTypeDefs
} = require('apollo-server-adonis-directives-pack/src/directives/mutation/Create')

makeExecutableSchema({ 
  /* ... */ 
  typeDefs: [ CreateTypeDefs, /* ... */ ],
  schemaDirectives: { CreateDirective, /* ... */} 
})

Definition

CreateTypeDefs
directive @create(
  # By default, the model will be calculated from the name
  # of the returned "type" with the prefix 'App/Model/'
  model: String) on FIELD_DEFINITION

Example

input CreatePostInput {
    name: String!
    text: String
}

type Mutation {
    createPost(input: CreatePostInput!): Post @create
}

Last updated

Was this helpful?