isVideoChannelSupportValid,
isVideoChannelUsernameValid
} from '../../../helpers/custom-validators/video-channels'
-import { logger } from '../../../helpers/logger'
import { ActorModel } from '../../../models/actor/actor'
import { VideoChannelModel } from '../../../models/video/video-channel'
import { areValidationErrors, checkUserQuota, doesVideoChannelNameWithHostExist } from '../shared'
.custom(isVideoChannelSupportValid),
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking videoChannelsAdd parameters', { parameters: req.body })
-
if (areValidationErrors(req, res)) return
const actor = await ActorModel.loadLocalByName(req.body.name)
.custom(isBooleanValid).withMessage('Should have a valid bulkVideosSupportUpdate boolean field'),
(req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking videoChannelsUpdate parameters', { parameters: req.body })
-
if (areValidationErrors(req, res)) return
return next()
export const videoChannelsRemoveValidator = [
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking videoChannelsRemove parameters', { parameters: req.params })
-
if (!await checkVideoChannelIsNotTheLastOne(res.locals.videoChannel, res)) return
return next()
.exists(),
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking videoChannelsNameWithHostValidator parameters', { parameters: req.params })
-
if (areValidationErrors(req, res)) return
if (!await doesVideoChannelNameWithHostExist(req.params.nameWithHost, res)) return
.not().isEmpty(),
(req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking video channels search query', { parameters: req.query })
-
if (areValidationErrors(req, res)) return
return next()
.custom(isIdValid),
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- logger.debug('Checking videoChannelImport parameters', { parameters: req.body })
-
if (areValidationErrors(req, res)) return
const body: VideosImportInChannelCreate = req.body