aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/custom-validators/remote/videos.js4
-rw-r--r--server/helpers/custom-validators/videos.js6
2 files changed, 9 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/remote/videos.js b/server/helpers/custom-validators/remote/videos.js
index ba2d0bb93..e1636e0e6 100644
--- a/server/helpers/custom-validators/remote/videos.js
+++ b/server/helpers/custom-validators/remote/videos.js
@@ -92,7 +92,9 @@ function isCommonVideoAttributesValid (video) {
92 videosValidators.isVideoTagsValid(video.tags) && 92 videosValidators.isVideoTagsValid(video.tags) &&
93 videosValidators.isVideoRemoteIdValid(video.remoteId) && 93 videosValidators.isVideoRemoteIdValid(video.remoteId) &&
94 videosValidators.isVideoExtnameValid(video.extname) && 94 videosValidators.isVideoExtnameValid(video.extname) &&
95 videosValidators.isVideoViewsValid(video.views) 95 videosValidators.isVideoViewsValid(video.views) &&
96 videosValidators.isVideoLikesValid(video.likes) &&
97 videosValidators.isVideoDislikesValid(video.dislikes)
96} 98}
97 99
98function isRequestTypeAddValid (value) { 100function isRequestTypeAddValid (value) {
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
3const validator = require('express-validator').validator 3const validator = require('express-validator').validator
4const values = require('lodash/values')
4 5
5const constants = require('../../initializers/constants') 6const constants = require('../../initializers/constants')
6const usersValidators = require('./users') 7const 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
108function isVideoRatingTypeValid (value) {
109 return values(constants.VIDEO_RATE_TYPES).indexOf(value) !== -1
110}
111
106function isVideoFile (value, files) { 112function isVideoFile (value, files) {
107 // Should have files 113 // Should have files
108 if (!files) return false 114 if (!files) return false