Reputation: 17
I have an instance method namely isAdmin()
of a model,but I am unable to access it directly like in sequelize 3.
Here's the snippet:
BranchUser.findOne({ where: {branchUserBranchId: userid} }).then(user => {
console.log('user: ',user.isAdmin());
});
Upvotes: 0
Views: 144
Reputation: 1968
How are you defining the isAdmin()
method? Here's an example that works for me:
BranchUser.prototype.isAdmin = function () {
// sample instance code here:
if (this.adminFlag) {
console.log('yes, I am an admin. thanks for asking');
}
}
Upvotes: 1