aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-22 21:15:55 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-03-22 21:25:24 +0100
commit6e07c3de88791a0b342e0cc319590048117f9c2d (patch)
tree049f88d3f6d3ec0aeea09702a583deb86d6ef78f /server/helpers/custom-validators
parent2d7653dc8726185615bab66353c4e3fb8fbb5a5f (diff)
downloadPeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.tar.gz
PeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.tar.zst
PeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.zip
Add video category support
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}