- checkErrors(req, res, () => {
- checkVideoChannelExists(req.params.id, res, next)
- })
+ if (areValidationErrors(req, res)) return
+ if (!await isVideoChannelExist(req.params.id, res)) return
+
+ return next()
+ }
+]
+
+const videoChannelsShareValidator = [
+ 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 videoChannelShare parameters', { parameters: req.params })
+
+ if (areValidationErrors(req, res)) return
+ if (!await isVideoChannelExist(req.params.id, res)) return
+
+ const share = await VideoChannelShareModel.load(res.locals.video.id, req.params.accountId, undefined)
+ if (!share) {
+ return res.status(404)
+ .end()
+ }
+
+ res.locals.videoChannelShare = share
+
+ return next()