PeerTube/server/middlewares/validators/remote/videos.ts

38 lines
1.2 KiB
TypeScript
Raw Normal View History

2017-06-10 20:15:25 +00:00
import 'express-validator'
import * as express from 'express'
2017-05-15 20:22:03 +00:00
import { logger } from '../../../helpers'
import { checkErrors } from '../utils'
2017-01-04 19:59:23 +00:00
2017-06-10 20:15:25 +00:00
function remoteVideosValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
2017-01-04 19:59:23 +00:00
req.checkBody('data').isEachRemoteRequestVideosValid()
logger.debug('Checking remoteVideos parameters', { parameters: req.body })
checkErrors(req, res, next)
}
2017-06-10 20:15:25 +00:00
function remoteQaduVideosValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
req.checkBody('data').isEachRemoteRequestVideosQaduValid()
2017-02-26 17:57:33 +00:00
logger.debug('Checking remoteQaduVideos parameters', { parameters: req.body })
checkErrors(req, res, next)
}
2017-06-10 20:15:25 +00:00
function remoteEventsVideosValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
2017-02-26 17:57:33 +00:00
req.checkBody('data').isEachRemoteRequestVideosEventsValid()
logger.debug('Checking remoteEventsVideos parameters', { parameters: req.body })
checkErrors(req, res, next)
}
2017-05-15 20:22:03 +00:00
2017-01-04 19:59:23 +00:00
// ---------------------------------------------------------------------------
2017-05-15 20:22:03 +00:00
export {
remoteVideosValidator,
remoteQaduVideosValidator,
remoteEventsVideosValidator
}