aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/videos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-02-21 21:35:59 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-02-26 20:01:26 +0100
commit9e167724f7e933f41d9ea2e1c31772bf4c560a28 (patch)
tree093cb7c1b088f35aaf847f859a313a121c8cd233 /server/helpers/custom-validators/videos.js
parent0150b17e51df3e9fad8a59133d828c68f8ba672b (diff)
downloadPeerTube-9e167724f7e933f41d9ea2e1c31772bf4c560a28.tar.gz
PeerTube-9e167724f7e933f41d9ea2e1c31772bf4c560a28.tar.zst
PeerTube-9e167724f7e933f41d9ea2e1c31772bf4c560a28.zip
Server: make a basic "quick and dirty update" for videos
This system will be useful to to update some int video attributes (likes, dislikes, views...) The classic system is not used because we need some optimization for scaling
Diffstat (limited to 'server/helpers/custom-validators/videos.js')
-rw-r--r--server/helpers/custom-validators/videos.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js
index e2d2c8e6d..1d844118b 100644
--- a/server/helpers/custom-validators/videos.js
+++ b/server/helpers/custom-validators/videos.js
@@ -22,7 +22,10 @@ const videosValidators = {
22 isVideoRemoteIdValid, 22 isVideoRemoteIdValid,
23 isVideoAbuseReasonValid, 23 isVideoAbuseReasonValid,
24 isVideoAbuseReporterUsernameValid, 24 isVideoAbuseReporterUsernameValid,
25 isVideoFile 25 isVideoFile,
26 isVideoViewsValid,
27 isVideoLikesValid,
28 isVideoDislikesValid
26} 29}
27 30
28function isVideoAuthorValid (value) { 31function isVideoAuthorValid (value) {
@@ -82,6 +85,18 @@ function isVideoAbuseReporterUsernameValid (value) {
82 return usersValidators.isUserUsernameValid(value) 85 return usersValidators.isUserUsernameValid(value)
83} 86}
84 87
88function isVideoViewsValid (value) {
89 return validator.isInt(value, { min: 0 })
90}
91
92function isVideoLikesValid (value) {
93 return validator.isInt(value, { min: 0 })
94}
95
96function isVideoDislikesValid (value) {
97 return validator.isInt(value, { min: 0 })
98}
99
85function isVideoFile (value, files) { 100function isVideoFile (value, files) {
86 // Should have files 101 // Should have files
87 if (!files) return false 102 if (!files) return false