diff options
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/custom-validators/misc.ts | 6 | ||||
-rw-r--r-- | server/helpers/custom-validators/user-notifications.ts | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts index a093e3e1b..b6f0ebe6f 100644 --- a/server/helpers/custom-validators/misc.ts +++ b/server/helpers/custom-validators/misc.ts | |||
@@ -9,8 +9,8 @@ function isArray (value: any) { | |||
9 | return Array.isArray(value) | 9 | return Array.isArray(value) |
10 | } | 10 | } |
11 | 11 | ||
12 | function isIntArray (value: any) { | 12 | function isNotEmptyIntArray (value: any) { |
13 | return Array.isArray(value) && value.every(v => validator.isInt('' + v)) | 13 | return Array.isArray(value) && value.every(v => validator.isInt('' + v)) && value.length !== 0 |
14 | } | 14 | } |
15 | 15 | ||
16 | function isDateValid (value: string) { | 16 | function isDateValid (value: string) { |
@@ -82,7 +82,7 @@ function isFileValid ( | |||
82 | 82 | ||
83 | export { | 83 | export { |
84 | exists, | 84 | exists, |
85 | isIntArray, | 85 | isNotEmptyIntArray, |
86 | isArray, | 86 | isArray, |
87 | isIdValid, | 87 | isIdValid, |
88 | isUUIDValid, | 88 | isUUIDValid, |
diff --git a/server/helpers/custom-validators/user-notifications.ts b/server/helpers/custom-validators/user-notifications.ts index 4fb5d922d..02ea3bbc2 100644 --- a/server/helpers/custom-validators/user-notifications.ts +++ b/server/helpers/custom-validators/user-notifications.ts | |||
@@ -9,8 +9,12 @@ function isUserNotificationTypeValid (value: any) { | |||
9 | 9 | ||
10 | function isUserNotificationSettingValid (value: any) { | 10 | function isUserNotificationSettingValid (value: any) { |
11 | return exists(value) && | 11 | return exists(value) && |
12 | validator.isInt('' + value) && | 12 | validator.isInt('' + value) && ( |
13 | UserNotificationSettingValue[ value ] !== undefined | 13 | value === UserNotificationSettingValue.NONE || |
14 | value === UserNotificationSettingValue.WEB || | ||
15 | value === UserNotificationSettingValue.EMAIL || | ||
16 | value === (UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL) | ||
17 | ) | ||
14 | } | 18 | } |
15 | 19 | ||
16 | export { | 20 | export { |