Trying to define a function inside the model so that I can have a common set of functions.Here is my code for my table. I am using sequelize ORM and nodejs
"use strict";
module.exports = function(sequelize, DataTypes) {
var AttendantUser = sequelize.define('AttendantUser', {
user_id : {
type : DataTypes.CHAR(36),
defaultValue : DataTypes.UUIDV4,
primaryKey : true
},
mobile : {
type : DataTypes.BIGINT,
allowNull : false,
unique : true
},
reset_code : {
type : DataTypes.INTEGER,
allowNull : true,
defaultValue : '0000'
}
},{
freezeTableName : true,
paranoid : true
});
AttendantUser.usernameInUse = function (callback) {
console.log("fefe");
callback(null, "hello");
}
return AttendantUser;
};
The error I get when I try to use usernameInUse function is . error: mModels.usernameInUse is not a function
via sac Dahal
No comments:
Post a Comment