From b0f9f39ed70299a208d1b388c72de8b7f3510cb7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 4 Sep 2017 20:07:54 +0200 Subject: Begin user quota --- server/helpers/custom-validators/users.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'server/helpers') diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts index 2b37bdde8..00061f9df 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts @@ -15,6 +15,10 @@ function isUserRoleValid (value: string) { return values(USER_ROLES).indexOf(value as UserRole) !== -1 } +function isUserVideoQuotaValid (value: string) { + return exists(value) && validator.isInt(value + '', USERS_CONSTRAINTS_FIELDS.VIDEO_QUOTA) +} + function isUserUsernameValid (value: string) { const max = USERS_CONSTRAINTS_FIELDS.USERNAME.max const min = USERS_CONSTRAINTS_FIELDS.USERNAME.min @@ -30,6 +34,7 @@ function isUserDisplayNSFWValid (value: any) { export { isUserPasswordValid, isUserRoleValid, + isUserVideoQuotaValid, isUserUsernameValid, isUserDisplayNSFWValid } @@ -39,6 +44,7 @@ declare module 'express-validator' { isUserPasswordValid, isUserRoleValid, isUserUsernameValid, - isUserDisplayNSFWValid + isUserDisplayNSFWValid, + isUserVideoQuotaValid } } -- cgit v1.2.3