Hi guys I have a quick question Im using sequalize. and I created user model, that has field email, that has validation for emails like this
module.exports = (sequelize, DataTypes) => sequelize.define('user', {
name: {
type: DataTypes.STRING,
},
phone: {
type: DataTypes.STRING,
},
email: {
type: DataTypes.STRING,
validate: {
isEmail: true,
},
},
});
but sometimes in my app I would like to create user with no email, or email to be emtpy string... but validation doesnt allow me to .. is there any way in some cases to allow empty string to be saved as email, but in others to run validation ???