aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-11 13:47:50 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-16 20:29:26 +0100
commit558d7c2385d8a152a94140eed753f511e90986d7 (patch)
treef40c641f2fdca7a912f70a1634081fe7355aa205 /server/helpers/custom-validators
parent6a94a109b4b89a97fe7bfeded3125fb7aad2ac3b (diff)
downloadPeerTube-558d7c2385d8a152a94140eed753f511e90986d7.tar.gz
PeerTube-558d7c2385d8a152a94140eed753f511e90986d7.tar.zst
PeerTube-558d7c2385d8a152a94140eed753f511e90986d7.zip
Server: use _id for image and video files. Add remoteId field
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/videos.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js
index a507ff686..c4c59808f 100644
--- a/server/helpers/custom-validators/videos.js
+++ b/server/helpers/custom-validators/videos.js
@@ -35,12 +35,13 @@ function isEachRemoteVideosValid (requests) {
35 isVideoNameValid(video.name) && 35 isVideoNameValid(video.name) &&
36 isVideoPodUrlValid(video.podUrl) && 36 isVideoPodUrlValid(video.podUrl) &&
37 isVideoTagsValid(video.tags) && 37 isVideoTagsValid(video.tags) &&
38 isVideoThumbnail64Valid(video.thumbnailBase64) 38 isVideoThumbnail64Valid(video.thumbnailBase64) &&
39 isVideoRemoteIdValid(video.remoteId)
39 ) || 40 ) ||
40 ( 41 (
41 isRequestTypeRemoveValid(request.type) && 42 isRequestTypeRemoveValid(request.type) &&
42 isVideoNameValid(video.name) && 43 isVideoNameValid(video.name) &&
43 isVideoMagnetUriValid(video.magnetUri) 44 isVideoRemoteIdValid(video.remoteId)
44 ) 45 )
45 }) 46 })
46} 47}
@@ -92,6 +93,10 @@ function isVideoThumbnail64Valid (value) {
92 validator.isByteLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL64) 93 validator.isByteLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL64)
93} 94}
94 95
96function isVideoRemoteIdValid (value) {
97 return validator.isMongoId(value)
98}
99
95// --------------------------------------------------------------------------- 100// ---------------------------------------------------------------------------
96 101
97module.exports = videosValidators 102module.exports = videosValidators