aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/videos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-08 21:35:43 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-03-08 21:35:43 +0100
commitd38b82810638b9f664c9016fac2684454c273a77 (patch)
tree9465c367e5033675309efca4d66790c6fdd5230d /server/helpers/custom-validators/videos.js
parent8f9064432122cba0f518a24ac4378357dadec589 (diff)
downloadPeerTube-d38b82810638b9f664c9016fac2684454c273a77.tar.gz
PeerTube-d38b82810638b9f664c9016fac2684454c273a77.tar.zst
PeerTube-d38b82810638b9f664c9016fac2684454c273a77.zip
Add like/dislike system for videos
Diffstat (limited to 'server/helpers/custom-validators/videos.js')
-rw-r--r--server/helpers/custom-validators/videos.js6
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
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