From 7d78d3691e615ef893a044d3481511c9efc561e4 Mon Sep 17 00:00:00 2001 From: holabayor Date: Sat, 23 Sep 2023 10:43:10 +0100 Subject: [PATCH] email validation on the model --- models/organisation_invite.model.js | 3 +++ models/user.model.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/models/organisation_invite.model.js b/models/organisation_invite.model.js index d97637a4..cce36883 100644 --- a/models/organisation_invite.model.js +++ b/models/organisation_invite.model.js @@ -13,6 +13,9 @@ const orgInvites = sequelize.define( email: { type: DataTypes.STRING, allowNull: false, + validate: { + isEmail: { msg: 'Invalid email' }, + }, }, token: { type: DataTypes.STRING, diff --git a/models/user.model.js b/models/user.model.js index b6eb91d9..8176654d 100644 --- a/models/user.model.js +++ b/models/user.model.js @@ -22,6 +22,9 @@ const User = sequelize.define( type: DataTypes.STRING, unique: true, allowNull: false, + validate: { + isEmail: { msg: 'Invalid email' }, + }, }, password_hash: { type: DataTypes.STRING,