aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/users.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/users.ts')
-rw-r--r--server/middlewares/validators/users.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts
index c8baf22e2..6c5e783e9 100644
--- a/server/middlewares/validators/users.ts
+++ b/server/middlewares/validators/users.ts
@@ -12,7 +12,8 @@ import {
12 isUserPasswordValid, 12 isUserPasswordValid,
13 isUserRoleValid, 13 isUserRoleValid,
14 isUserUsernameValid, 14 isUserUsernameValid,
15 isUserVideoQuotaValid 15 isUserVideoQuotaValid,
16 isUserVideoQuotaDailyValid
16} from '../../helpers/custom-validators/users' 17} from '../../helpers/custom-validators/users'
17import { isVideoExist } from '../../helpers/custom-validators/videos' 18import { isVideoExist } from '../../helpers/custom-validators/videos'
18import { logger } from '../../helpers/logger' 19import { logger } from '../../helpers/logger'
@@ -27,6 +28,7 @@ const usersAddValidator = [
27 body('password').custom(isUserPasswordValid).withMessage('Should have a valid password'), 28 body('password').custom(isUserPasswordValid).withMessage('Should have a valid password'),
28 body('email').isEmail().withMessage('Should have a valid email'), 29 body('email').isEmail().withMessage('Should have a valid email'),
29 body('videoQuota').custom(isUserVideoQuotaValid).withMessage('Should have a valid user quota'), 30 body('videoQuota').custom(isUserVideoQuotaValid).withMessage('Should have a valid user quota'),
31 body('videoQuotaDaily').custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily user quota'),
30 body('role').custom(isUserRoleValid).withMessage('Should have a valid role'), 32 body('role').custom(isUserRoleValid).withMessage('Should have a valid role'),
31 33
32 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 34 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
@@ -112,6 +114,7 @@ const usersUpdateValidator = [
112 param('id').isInt().not().isEmpty().withMessage('Should have a valid id'), 114 param('id').isInt().not().isEmpty().withMessage('Should have a valid id'),
113 body('email').optional().isEmail().withMessage('Should have a valid email attribute'), 115 body('email').optional().isEmail().withMessage('Should have a valid email attribute'),
114 body('videoQuota').optional().custom(isUserVideoQuotaValid).withMessage('Should have a valid user quota'), 116 body('videoQuota').optional().custom(isUserVideoQuotaValid).withMessage('Should have a valid user quota'),
117 body('videoQuotaDaily').optional().custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily user quota'),
115 body('role').optional().custom(isUserRoleValid).withMessage('Should have a valid role'), 118 body('role').optional().custom(isUserRoleValid).withMessage('Should have a valid role'),
116 119
117 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 120 async (req: express.Request, res: express.Response, next: express.NextFunction) => {