import { isIdValid } from '../../../helpers/custom-validators/misc'
import { isRatingValid } from '../../../helpers/custom-validators/video-rates'
import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos'
-import { logger } from '../../../helpers/logger'
import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
import { areValidationErrors, checkCanSeeVideo, doesVideoExist, isValidVideoIdParam } from '../shared'
.custom(isVideoRatingTypeValid),
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 doesVideoExist(req.params.id, res)) return
.custom(isIdValid),
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params })
-
if (areValidationErrors(req, res)) return
const rate = await AccountVideoRateModel.loadLocalAndPopulateVideo(rateType, req.params.name, +req.params.videoId)
.custom(isRatingValid).withMessage('Value must be one of "like" or "dislike"'),
(req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking rating parameter', { parameters: req.params })
-
if (areValidationErrors(req, res)) return
return next()