aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/author.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/author.js')
-rw-r--r--server/models/author.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/server/models/author.js b/server/models/author.js
index 493c2ca11..e0ac868ea 100644
--- a/server/models/author.js
+++ b/server/models/author.js
@@ -1,8 +1,19 @@
1'use strict'
2
3const customUsersValidators = require('../helpers/custom-validators').users
4
1module.exports = function (sequelize, DataTypes) { 5module.exports = function (sequelize, DataTypes) {
2 const Author = sequelize.define('Author', 6 const Author = sequelize.define('Author',
3 { 7 {
4 name: { 8 name: {
5 type: DataTypes.STRING 9 type: DataTypes.STRING,
10 allowNull: false,
11 validate: {
12 usernameValid: function (value) {
13 const res = customUsersValidators.isUserUsernameValid(value)
14 if (res === false) throw new Error('Username is not valid.')
15 }
16 }
6 } 17 }
7 }, 18 },
8 { 19 {