-const videoRateValidator = [
- param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'),
- body('rating').custom(isVideoRatingTypeValid).withMessage('Should have a valid rate type'),
-
- async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking videoRate parameters', { parameters: req.body })
-
- if (areValidationErrors(req, res)) return
- if (!await isVideoExist(req.params.id, res)) return
-
- return next()
- }
-]
-
-const videosShareValidator = [
- param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'),
- param('accountId').custom(isIdValid).not().isEmpty().withMessage('Should have a valid account id'),
-
- async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking videoShare parameters', { parameters: req.params })
-
- if (areValidationErrors(req, res)) return
- if (!await isVideoExist(req.params.id, res)) return
-
- const share = await VideoShareModel.load(req.params.accountId, res.locals.video.id, undefined)
- if (!share) {
- return res.status(404)
- .end()
- }
-
- res.locals.videoShare = share
- return next()
- }
-]
-