aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-06-24 17:42:51 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-06-24 17:42:51 +0200
commitaaf61f3810e6d57c5130af959bd2860df32775e7 (patch)
tree3871b20359aa56995a4b8974ae5cb6b911dd73f5 /server/helpers
parent07d932038745e773359fa87bac6be70523f593ee (diff)
downloadPeerTube-aaf61f3810e6d57c5130af959bd2860df32775e7.tar.gz
PeerTube-aaf61f3810e6d57c5130af959bd2860df32775e7.tar.zst
PeerTube-aaf61f3810e6d57c5130af959bd2860df32775e7.zip
Video model refractoring -> use mongoose api
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/customValidators.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/server/helpers/customValidators.js b/server/helpers/customValidators.js
index a6cf680e5..4d6139a3d 100644
--- a/server/helpers/customValidators.js
+++ b/server/helpers/customValidators.js
@@ -17,7 +17,8 @@ const customValidators = {
17 isVideoNameValid: isVideoNameValid, 17 isVideoNameValid: isVideoNameValid,
18 isVideoPodUrlValid: isVideoPodUrlValid, 18 isVideoPodUrlValid: isVideoPodUrlValid,
19 isVideoTagsValid: isVideoTagsValid, 19 isVideoTagsValid: isVideoTagsValid,
20 isVideoThumbnailValid: isVideoThumbnailValid 20 isVideoThumbnailValid: isVideoThumbnailValid,
21 isVideoThumbnail64Valid: isVideoThumbnail64Valid
21} 22}
22 23
23function exists (value) { 24function exists (value) {
@@ -37,7 +38,7 @@ function isEachRemoteVideosValid (requests) {
37 isVideoNameValid(video.name) && 38 isVideoNameValid(video.name) &&
38 isVideoPodUrlValid(video.podUrl) && 39 isVideoPodUrlValid(video.podUrl) &&
39 isVideoTagsValid(video.tags) && 40 isVideoTagsValid(video.tags) &&
40 isVideoThumbnailValid(video.thumbnailBase64) 41 isVideoThumbnail64Valid(video.thumbnailBase64)
41 ) || 42 ) ||
42 ( 43 (
43 isRequestTypeRemoveValid(request.type) && 44 isRequestTypeRemoveValid(request.type) &&
@@ -97,8 +98,12 @@ function isVideoTagsValid (tags) {
97} 98}
98 99
99function isVideoThumbnailValid (value) { 100function isVideoThumbnailValid (value) {
101 return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL)
102}
103
104function isVideoThumbnail64Valid (value) {
100 return validator.isBase64(value) && 105 return validator.isBase64(value) &&
101 validator.isByteLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL) 106 validator.isByteLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL64)
102} 107}
103 108
104// --------------------------------------------------------------------------- 109// ---------------------------------------------------------------------------