objection.js
objection.js copied to clipboard
HasMany through relation Feature Request
Does objection has HasManyRelation through relation, I wanted something like this
users: {
relation: Model.HasManyRelation, // hasManyThorugh needed
modelClass: User,
join: {
from: 'marksheets.id',
through: {
modelClass: MarksheetMember,
from: 'marksheetMembers.marksheetid',
to: 'marksheetMembers.userId',
},
to: 'users.id',
},
},
Otherwise, i have to
await db.Marksheet.query().findById(marksheetId).withGraphFetched('users.user') // if it is not through relation
HasManyThrough is a ManyToMany Relation, you could just use ManyToMany