1 import { body, param } from 'express-validator/check'
2 import * as express from 'express'
3 import { isIdOrUUIDValid } from '../../../helpers/custom-validators/misc'
4 import { isVideoExist } from '../../../helpers/custom-validators/videos'
5 import { areValidationErrors } from '../utils'
6 import { logger } from '../../../helpers/logger'
8 const videoWatchingValidator = [
9 param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'),
12 .isInt().withMessage('Should have correct current time'),
14 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
15 logger.debug('Checking videoWatching parameters', { parameters: req.body })
17 if (areValidationErrors(req, res)) return
18 if (!await isVideoExist(req.params.videoId, res, 'id')) return
24 // ---------------------------------------------------------------------------
27 videoWatchingValidator