mirror of
https://gitlab.com/Alamantus/Readlebee.git
synced 2025-06-27 19:54:17 +02:00
Add validation to User sequelize model
This commit is contained in:
parent
3634774ff9
commit
52f603ccc4
1 changed files with 11 additions and 0 deletions
|
@ -11,16 +11,27 @@ function getSequelizeModels (sequelize) {
|
|||
type: Sequelize.STRING,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
validate: {
|
||||
isEmail: true,
|
||||
len: [5, 150],
|
||||
},
|
||||
},
|
||||
username: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
validate: {
|
||||
is: /^[a-z0-9_]+$/i, // Is a set of characters a-z, 0-9, or _, case insensitive
|
||||
len: [2, 32],
|
||||
},
|
||||
},
|
||||
displayName: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
validate: {
|
||||
len: [2, 32],
|
||||
},
|
||||
},
|
||||
passwordHash: {
|
||||
type: Sequelize.STRING,
|
||||
|
|
Loading…
Add table
Reference in a new issue