Server: fix remote videos requests validator
This commit is contained in:
parent
4613274479
commit
6c1a098b41
|
@ -22,26 +22,27 @@ const videosValidators = {
|
|||
}
|
||||
|
||||
function isEachRemoteVideosValid (requests) {
|
||||
return requests.every(function (request) {
|
||||
const video = request.data
|
||||
return (
|
||||
isRequestTypeAddValid(request.type) &&
|
||||
isVideoAuthorValid(video.author) &&
|
||||
isVideoDateValid(video.createdDate) &&
|
||||
isVideoDescriptionValid(video.description) &&
|
||||
isVideoDurationValid(video.duration) &&
|
||||
isVideoMagnetUriValid(video.magnetUri) &&
|
||||
isVideoNameValid(video.name) &&
|
||||
isVideoPodUrlValid(video.podUrl) &&
|
||||
isVideoTagsValid(video.tags) &&
|
||||
isVideoThumbnail64Valid(video.thumbnailBase64)
|
||||
) ||
|
||||
(
|
||||
isRequestTypeRemoveValid(request.type) &&
|
||||
isVideoNameValid(video.name) &&
|
||||
isVideoMagnetUriValid(video.magnetUri)
|
||||
)
|
||||
})
|
||||
return miscValidators.isArray(requests) &&
|
||||
requests.every(function (request) {
|
||||
const video = request.data
|
||||
return (
|
||||
isRequestTypeAddValid(request.type) &&
|
||||
isVideoAuthorValid(video.author) &&
|
||||
isVideoDateValid(video.createdDate) &&
|
||||
isVideoDescriptionValid(video.description) &&
|
||||
isVideoDurationValid(video.duration) &&
|
||||
isVideoMagnetUriValid(video.magnetUri) &&
|
||||
isVideoNameValid(video.name) &&
|
||||
isVideoPodUrlValid(video.podUrl) &&
|
||||
isVideoTagsValid(video.tags) &&
|
||||
isVideoThumbnail64Valid(video.thumbnailBase64)
|
||||
) ||
|
||||
(
|
||||
isRequestTypeRemoveValid(request.type) &&
|
||||
isVideoNameValid(video.name) &&
|
||||
isVideoMagnetUriValid(video.magnetUri)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
function isVideoAuthorValid (value) {
|
||||
|
|
|
@ -19,7 +19,6 @@ function dataToDecrypt (req, res, next) {
|
|||
}
|
||||
|
||||
function remoteVideos (req, res, next) {
|
||||
req.checkBody('data').isArray()
|
||||
req.checkBody('data').isEachRemoteVideosValid()
|
||||
|
||||
logger.debug('Checking remoteVideos parameters', { parameters: req.body })
|
||||
|
|
Loading…
Reference in New Issue