diff options
Diffstat (limited to 'server/helpers/custom-validators/videos.js')
-rw-r--r-- | server/helpers/custom-validators/videos.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js index 1d844118b..c5a1f3cb5 100644 --- a/server/helpers/custom-validators/videos.js +++ b/server/helpers/custom-validators/videos.js | |||
@@ -7,6 +7,7 @@ const usersValidators = require('./users') | |||
7 | const miscValidators = require('./misc') | 7 | const miscValidators = require('./misc') |
8 | const VIDEOS_CONSTRAINTS_FIELDS = constants.CONSTRAINTS_FIELDS.VIDEOS | 8 | const VIDEOS_CONSTRAINTS_FIELDS = constants.CONSTRAINTS_FIELDS.VIDEOS |
9 | const VIDEO_ABUSES_CONSTRAINTS_FIELDS = constants.CONSTRAINTS_FIELDS.VIDEO_ABUSES | 9 | const VIDEO_ABUSES_CONSTRAINTS_FIELDS = constants.CONSTRAINTS_FIELDS.VIDEO_ABUSES |
10 | const VIDEO_EVENTS_CONSTRAINTS_FIELDS = constants.CONSTRAINTS_FIELDS.VIDEO_EVENTS | ||
10 | 11 | ||
11 | const videosValidators = { | 12 | const videosValidators = { |
12 | isVideoAuthorValid, | 13 | isVideoAuthorValid, |
@@ -25,7 +26,8 @@ const videosValidators = { | |||
25 | isVideoFile, | 26 | isVideoFile, |
26 | isVideoViewsValid, | 27 | isVideoViewsValid, |
27 | isVideoLikesValid, | 28 | isVideoLikesValid, |
28 | isVideoDislikesValid | 29 | isVideoDislikesValid, |
30 | isVideoEventCountValid | ||
29 | } | 31 | } |
30 | 32 | ||
31 | function isVideoAuthorValid (value) { | 33 | function isVideoAuthorValid (value) { |
@@ -86,15 +88,19 @@ function isVideoAbuseReporterUsernameValid (value) { | |||
86 | } | 88 | } |
87 | 89 | ||
88 | function isVideoViewsValid (value) { | 90 | function isVideoViewsValid (value) { |
89 | return validator.isInt(value, { min: 0 }) | 91 | return validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.VIEWS) |
90 | } | 92 | } |
91 | 93 | ||
92 | function isVideoLikesValid (value) { | 94 | function isVideoLikesValid (value) { |
93 | return validator.isInt(value, { min: 0 }) | 95 | return validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.LIKES) |
94 | } | 96 | } |
95 | 97 | ||
96 | function isVideoDislikesValid (value) { | 98 | function isVideoDislikesValid (value) { |
97 | return validator.isInt(value, { min: 0 }) | 99 | return validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.DISLIKES) |
100 | } | ||
101 | |||
102 | function isVideoEventCountValid (value) { | ||
103 | return validator.isInt(value + '', VIDEO_EVENTS_CONSTRAINTS_FIELDS.COUNT) | ||
98 | } | 104 | } |
99 | 105 | ||
100 | function isVideoFile (value, files) { | 106 | function isVideoFile (value, files) { |