Hi @BK42,
Thank you for sharing your issue!
As stated by the error message, it seems that sequelize requires an as
option when defining a belongsToMany relationship.
If you look at your parent
foreignKey definition, it has an as
option that allows it to be called with another name. You must define the same on your belongsToMany definitions:
ParameterOutlines.belongsToMany(models.parameterOutlines, {
through: 'subParameterOutlines',
foreignKey: 'parameter_outline_id',
otherKey: 'sub_parameter_outline_id',
as: 'subParameterOutlines', // this is an example name, use one that suits your needs
});
I hope this helps!