toIntOrNull
} from '../../helpers/custom-validators/misc'
import { isHostValid } from '../../helpers/custom-validators/servers'
-import { logger } from '../../helpers/logger'
import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
import { ServerModel } from '../../models/server/server'
import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from './shared'
.custom(exists),
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking videoFileRedundancyGetValidator parameters', { parameters: req.params })
-
if (areValidationErrors(req, res)) return
if (!await doesVideoExist(req.params.videoId, res)) return
.custom(exists),
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking videoPlaylistRedundancyGetValidator parameters', { parameters: req.params })
-
if (areValidationErrors(req, res)) return
if (!await doesVideoExist(req.params.videoId, res)) return
.custom(isBooleanValid).withMessage('Should have a valid redundancyAllowed boolean'),
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking updateServerRedundancy parameters', { parameters: req.params })
-
if (areValidationErrors(req, res)) return
const server = await ServerModel.loadByHost(req.params.host)
.custom(isVideoRedundancyTarget),
(req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking listVideoRedundanciesValidator parameters', { parameters: req.query })
-
if (areValidationErrors(req, res)) return
return next()
.custom(isIdOrUUIDValid),
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking addVideoRedundancyValidator parameters', { parameters: req.query })
-
if (areValidationErrors(req, res)) return
if (!await doesVideoExist(req.body.videoId, res, 'only-video')) return
.custom(isIdValid),
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking removeVideoRedundancyValidator parameters', { parameters: req.query })
-
if (areValidationErrors(req, res)) return
const redundancy = await VideoRedundancyModel.loadByIdWithVideo(parseInt(req.params.redundancyId, 10))