aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/remote/videos.js1
-rw-r--r--server/helpers/custom-validators/videos.js5
2 files changed, 6 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/remote/videos.js b/server/helpers/custom-validators/remote/videos.js
index e1636e0e6..701acdbfd 100644
--- a/server/helpers/custom-validators/remote/videos.js
+++ b/server/helpers/custom-validators/remote/videos.js
@@ -85,6 +85,7 @@ module.exports = remoteVideosValidators
85function isCommonVideoAttributesValid (video) { 85function isCommonVideoAttributesValid (video) {
86 return videosValidators.isVideoDateValid(video.createdAt) && 86 return videosValidators.isVideoDateValid(video.createdAt) &&
87 videosValidators.isVideoDateValid(video.updatedAt) && 87 videosValidators.isVideoDateValid(video.updatedAt) &&
88 videosValidators.isVideoCategoryValid(video.category) &&
88 videosValidators.isVideoDescriptionValid(video.description) && 89 videosValidators.isVideoDescriptionValid(video.description) &&
89 videosValidators.isVideoDurationValid(video.duration) && 90 videosValidators.isVideoDurationValid(video.duration) &&
90 videosValidators.isVideoInfoHashValid(video.infoHash) && 91 videosValidators.isVideoInfoHashValid(video.infoHash) &&
diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js
index 648c7540b..92b366717 100644
--- a/server/helpers/custom-validators/videos.js
+++ b/server/helpers/custom-validators/videos.js
@@ -13,6 +13,7 @@ const VIDEO_EVENTS_CONSTRAINTS_FIELDS = constants.CONSTRAINTS_FIELDS.VIDEO_EVENT
13const videosValidators = { 13const videosValidators = {
14 isVideoAuthorValid, 14 isVideoAuthorValid,
15 isVideoDateValid, 15 isVideoDateValid,
16 isVideoCategoryValid,
16 isVideoDescriptionValid, 17 isVideoDescriptionValid,
17 isVideoDurationValid, 18 isVideoDurationValid,
18 isVideoInfoHashValid, 19 isVideoInfoHashValid,
@@ -40,6 +41,10 @@ function isVideoDateValid (value) {
40 return validator.isDate(value) 41 return validator.isDate(value)
41} 42}
42 43
44function isVideoCategoryValid (value) {
45 return constants.VIDEO_CATEGORIES[value] !== undefined
46}
47
43function isVideoDescriptionValid (value) { 48function isVideoDescriptionValid (value) {
44 return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION) 49 return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION)
45} 50}