2017-09-15 10:17:08 +00:00
|
|
|
import { body } from 'express-validator/check'
|
2017-06-10 20:15:25 +00:00
|
|
|
import * as express from 'express'
|
|
|
|
|
2017-09-15 10:17:08 +00:00
|
|
|
import {
|
|
|
|
logger,
|
2017-10-26 08:40:37 +00:00
|
|
|
isArray,
|
|
|
|
removeBadRequestVideos,
|
|
|
|
removeBadRequestVideosQadu,
|
|
|
|
removeBadRequestVideosEvents
|
2017-09-15 10:17:08 +00:00
|
|
|
} from '../../../helpers'
|
2017-05-15 20:22:03 +00:00
|
|
|
import { checkErrors } from '../utils'
|
2017-01-04 19:59:23 +00:00
|
|
|
|
2017-09-15 10:17:08 +00:00
|
|
|
const remoteVideosValidator = [
|
2017-10-26 08:40:37 +00:00
|
|
|
body('data').custom(isArray),
|
2017-01-04 19:59:23 +00:00
|
|
|
|
2017-09-15 10:17:08 +00:00
|
|
|
(req: express.Request, res: express.Response, next: express.NextFunction) => {
|
|
|
|
logger.debug('Checking remoteVideos parameters', { parameters: req.body })
|
2017-01-04 19:59:23 +00:00
|
|
|
|
2017-10-26 08:40:37 +00:00
|
|
|
checkErrors(req, res, () => {
|
|
|
|
removeBadRequestVideos(req.body.data)
|
|
|
|
|
|
|
|
return next()
|
|
|
|
})
|
2017-09-15 10:17:08 +00:00
|
|
|
}
|
|
|
|
]
|
2017-01-04 19:59:23 +00:00
|
|
|
|
2017-09-15 10:17:08 +00:00
|
|
|
const remoteQaduVideosValidator = [
|
2017-10-26 08:40:37 +00:00
|
|
|
body('data').custom(isArray),
|
2017-02-21 20:35:59 +00:00
|
|
|
|
2017-09-15 10:17:08 +00:00
|
|
|
(req: express.Request, res: express.Response, next: express.NextFunction) => {
|
|
|
|
logger.debug('Checking remoteQaduVideos parameters', { parameters: req.body })
|
2017-02-21 20:35:59 +00:00
|
|
|
|
2017-10-26 08:40:37 +00:00
|
|
|
checkErrors(req, res, () => {
|
|
|
|
removeBadRequestVideosQadu(req.body.data)
|
|
|
|
|
|
|
|
return next()
|
|
|
|
})
|
2017-09-15 10:17:08 +00:00
|
|
|
}
|
|
|
|
]
|
2017-02-21 20:35:59 +00:00
|
|
|
|
2017-09-15 10:17:08 +00:00
|
|
|
const remoteEventsVideosValidator = [
|
2017-10-26 08:40:37 +00:00
|
|
|
body('data').custom(isArray),
|
2017-02-26 17:57:33 +00:00
|
|
|
|
2017-09-15 10:17:08 +00:00
|
|
|
(req: express.Request, res: express.Response, next: express.NextFunction) => {
|
|
|
|
logger.debug('Checking remoteEventsVideos parameters', { parameters: req.body })
|
2017-02-26 17:57:33 +00:00
|
|
|
|
2017-10-26 08:40:37 +00:00
|
|
|
checkErrors(req, res, () => {
|
|
|
|
removeBadRequestVideosEvents(req.body.data)
|
|
|
|
|
|
|
|
return next()
|
|
|
|
})
|
2017-09-15 10:17:08 +00:00
|
|
|
}
|
|
|
|
]
|
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
|
|
|
|
}
|