aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorFelix Ableitner <me@nutomic.com>2018-08-28 02:01:35 -0500
committerChocobozzz <me@florianbigard.com>2018-08-28 09:01:35 +0200
commitbee0abffff73804d816b90c7fd599e0a51c09d61 (patch)
treefae6d58637f9c63a3800090277f8e130b43442dd /server/middlewares
parentc907c2fa3fd7c0a741117a0204d0ebca675124bd (diff)
downloadPeerTube-bee0abffff73804d816b90c7fd599e0a51c09d61.tar.gz
PeerTube-bee0abffff73804d816b90c7fd599e0a51c09d61.tar.zst
PeerTube-bee0abffff73804d816b90c7fd599e0a51c09d61.zip
Implement daily upload limit (#956)
* Implement daily upload limit (ref #652) * remove duplicate code * review fixes * fix tests? * whitespace fixes, finish leftover todo * fix tests * added some new tests * use different config value for tests * remove todo
Diffstat (limited to 'server/middlewares')
-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) => {