diff options
Diffstat (limited to 'server/helpers/custom-validators/videos.js')
-rw-r--r-- | server/helpers/custom-validators/videos.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js index c5a1f3cb5..648c7540b 100644 --- a/server/helpers/custom-validators/videos.js +++ b/server/helpers/custom-validators/videos.js | |||
@@ -1,6 +1,7 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const validator = require('express-validator').validator | 3 | const validator = require('express-validator').validator |
4 | const values = require('lodash/values') | ||
4 | 5 | ||
5 | const constants = require('../../initializers/constants') | 6 | const constants = require('../../initializers/constants') |
6 | const usersValidators = require('./users') | 7 | const usersValidators = require('./users') |
@@ -26,6 +27,7 @@ const videosValidators = { | |||
26 | isVideoFile, | 27 | isVideoFile, |
27 | isVideoViewsValid, | 28 | isVideoViewsValid, |
28 | isVideoLikesValid, | 29 | isVideoLikesValid, |
30 | isVideoRatingTypeValid, | ||
29 | isVideoDislikesValid, | 31 | isVideoDislikesValid, |
30 | isVideoEventCountValid | 32 | isVideoEventCountValid |
31 | } | 33 | } |
@@ -103,6 +105,10 @@ function isVideoEventCountValid (value) { | |||
103 | return validator.isInt(value + '', VIDEO_EVENTS_CONSTRAINTS_FIELDS.COUNT) | 105 | return validator.isInt(value + '', VIDEO_EVENTS_CONSTRAINTS_FIELDS.COUNT) |
104 | } | 106 | } |
105 | 107 | ||
108 | function isVideoRatingTypeValid (value) { | ||
109 | return values(constants.VIDEO_RATE_TYPES).indexOf(value) !== -1 | ||
110 | } | ||
111 | |||
106 | function isVideoFile (value, files) { | 112 | function isVideoFile (value, files) { |
107 | // Should have files | 113 | // Should have files |
108 | if (!files) return false | 114 | if (!files) return false |