Request one "Lucid" model by primary key
Required argument when writing a request
id - String/Int/ID
Other arguments are ignored.
/* ... */ const { FindDirective, FindTypeDefs } = require('apollo-server-adonis-directives-pack/src/directives/query/Find') makeExecutableSchema({ /* ... */ typeDefs: [ FindTypeDefs, /* ... */ ], schemaDirectives: { FindDirective, /* ... */} })
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
type Query { postFind(id: String!): Post @find }
Last updated 4 years ago
Was this helpful?