@find

Request one "Lucid" model by primary key

For a separate add use

/* ... */
const {
  FindDirective,
  FindTypeDefs
} = require('apollo-server-adonis-directives-pack/src/directives/query/Find')


makeExecutableSchema({ 
  /* ... */ 
  typeDefs: [ FindTypeDefs, /* ... */ ],
  schemaDirectives: { FindDirective, /* ... */} 
})

Definition

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

Find directive searches for the primary key of a model

Example

type Query {
    postFind(id: String!): Post @find
}

Last updated

Was this helpful?