+const videoSubscriptionFeedsValidator = [
+ query('accountId')
+ .custom(isIdValid)
+ .withMessage('Should have a valid account id'),
+
+ query('token')
+ .custom(exists)
+ .withMessage('Should have a token'),
+
+ async (req: express.Request, res: express.Response, next: express.NextFunction) => {
+ logger.debug('Checking subscription feeds parameters', { parameters: req.query })
+
+ if (areValidationErrors(req, res)) return
+
+ if (!await doesAccountIdExist(req.query.accountId, res)) return
+ if (!await doesUserFeedTokenCorrespond(res.locals.account.userId, req.query.token, res)) return
+
+ return next()
+ }
+]
+