@hasMany
One to many relationship
For a separate add use
/* ... */
const {
HasManyDirective,
HasManyTypeDefs
} = require('apollo-server-adonis-directives-pack/src/directives/relationship/HasMany')
makeExecutableSchema({
/* ... */
typeDefs: [ HasManyTypeDefs, /* ... */ ],
schemaDirectives: { HasManyDirective, /* ... */}
})Definition
directive @hasMany(
# By default, the model will be calculated from the name
# of the returned "type" with the prefix 'App/Model/'
model: String,
# By default, the column will be calculated from the name
# of the "type" with the postfix '_id'
ownerColumn: String,
# By default localColumn = 'id'
localColumn:String) on FIELD_DEFINITIONExample
This directive uses a DataLoader but does not cache the results.
Last updated
Was this helpful?