diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-06-24 17:42:51 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-06-24 17:42:51 +0200 |
commit | aaf61f3810e6d57c5130af959bd2860df32775e7 (patch) | |
tree | 3871b20359aa56995a4b8974ae5cb6b911dd73f5 /server/helpers | |
parent | 07d932038745e773359fa87bac6be70523f593ee (diff) | |
download | PeerTube-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.js | 11 |
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 | ||
23 | function exists (value) { | 24 | function 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 | ||
99 | function isVideoThumbnailValid (value) { | 100 | function isVideoThumbnailValid (value) { |
101 | return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL) | ||
102 | } | ||
103 | |||
104 | function 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 | // --------------------------------------------------------------------------- |