Suppose inside a model you have the following Sequelize instance method:
const Admins = require("./admin");
Organization.prototype.getAdmins = function () {
// option 1
return Admins.findAll({ where:
{ organization_id: this.getDataValue("id") }
});
// option 2
return sequelize.Admins.findAll({ where:
{ organization_id: this.getDataValue("id") }
});
};
Sometimes I see it written as option 1 and sometimes as option 2. When do you need which option? That is, when do you need to prepend sequelize.
before the model that you are referencing?