Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- issues.belongsToMany(models.labels, {
- through: 'issues_labels',
- foreignKey: 'issueId',
- as: 'labels'
- });
- issues.hasMany(models.issues_labels , {
- as: 'query'
- });
- labels.belongsToMany(models.issues, {
- through: 'issues_labels',
- foreignKey: 'labelId',
- constraints: false
- });
- issuesLabels.belongsTo(models.issues, {constraints: false});
- issuesLabels.belongsTo(models.labels, {constraints: false});
- issues.findAll(
- {
- include: [
- {
- model: labels,
- as: 'labels',
- },
- {
- model: issues_labels,
- as: 'query',
- where: {
- labelId: {
- [op.in]: [2, 3]
- }
- }
- },
- ]
- }
- )
Add Comment
Please, Sign In to add comment