diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-02-21 21:35:59 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-02-26 20:01:26 +0100 |
commit | 9e167724f7e933f41d9ea2e1c31772bf4c560a28 (patch) | |
tree | 093cb7c1b088f35aaf847f859a313a121c8cd233 /server/helpers/custom-validators/videos.js | |
parent | 0150b17e51df3e9fad8a59133d828c68f8ba672b (diff) | |
download | PeerTube-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.js | 17 |
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 | ||
28 | function isVideoAuthorValid (value) { | 31 | function isVideoAuthorValid (value) { |
@@ -82,6 +85,18 @@ function isVideoAbuseReporterUsernameValid (value) { | |||
82 | return usersValidators.isUserUsernameValid(value) | 85 | return usersValidators.isUserUsernameValid(value) |
83 | } | 86 | } |
84 | 87 | ||
88 | function isVideoViewsValid (value) { | ||
89 | return validator.isInt(value, { min: 0 }) | ||
90 | } | ||
91 | |||
92 | function isVideoLikesValid (value) { | ||
93 | return validator.isInt(value, { min: 0 }) | ||
94 | } | ||
95 | |||
96 | function isVideoDislikesValid (value) { | ||
97 | return validator.isInt(value, { min: 0 }) | ||
98 | } | ||
99 | |||
85 | function isVideoFile (value, files) { | 100 | function isVideoFile (value, files) { |
86 | // Should have files | 101 | // Should have files |
87 | if (!files) return false | 102 | if (!files) return false |