Thanks.
As it looks like you have multiple belongsToMany
on models.taskOutlines
, I wonder how it can work properly without aliases (ie as
attribute) to distinguish both relationships on a similar model.
Could you try the code below in ProcessOutlines
model to see if it fixes your issue?
ProcessOutlines.belongsToMany(models.taskOutlines, {
through: 'processOutlinesChildTaskOutlines',
foreignKey: 'process_outline_id',
otherKey: 'child_task_outline_id',
+ as: 'aliasOfFirstRelationship' // NOTICE: use a business oriented alias
});
ProcessOutlines.belongsToMany(models.taskOutlines, {
through: 'processOutlinesParentTaskOutlines',
foreignKey: 'process_outline_id',
otherKey: 'parent_task_outline_id',
+ as: 'aliasOfSecondRelationship' // NOTICE: use a business oriented alias
});
And try the same in TaskOutlines
models?
TaskOutlines.belongsToMany(models.processOutlines, {
through: 'processOutlinesChildTaskOutlines',
foreignKey: 'child_task_outline_id',
otherKey: 'process_outline_id',
+ as: 'aliasOfFirstRelationship' // NOTICE: use a business oriented alias
});
TaskOutlines.belongsToMany(models.processOutlines, {
through: 'processOutlinesParentTaskOutlines',
foreignKey: 'parent_task_outline_id',
otherKey: 'process_outline_id',
+ as: 'aliasOfSecondRelationship' // NOTICE: use a business oriented alias
});