@mvp-rockets/namma-generator
Version:
A generator to generate mvp-rockets projects
52 lines (50 loc) • 1.3 kB
JavaScript
const {
Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
class User extends Model {
/**
* Helper method for defining associations.
* This method is not a part of Sequelize lifecycle.
* The `models/index` file will call this method automatically.
*/
static associate(models) {
// define association here
}
}
User.init({
id: {
type: DataTypes.UUID,
primaryKey: true,
allowNull: false,
defaultValue: DataTypes.UUIDV4,
},
email: {
type: DataTypes.STRING,
unique: true,
},
username: {
type: DataTypes.STRING,
unique: true,
},
password: {
type: DataTypes.STRING,
},
mlVerificationToken: {
type: DataTypes.STRING,
field: 'ml_verifcation_token'
},
mlVerificationTokenExp: {
type: DataTypes.DATE,
field: 'ml_verifcation_token_exp'
},
}, {
sequelize,
modelName: 'User',
tableName: 'users',
underscored: true,
createdAt: 'created_at',
updatedAt: 'updated_at',
});
return User;
};