]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/middlewares/validators/jobs.ts
Add ability to schedule video publication
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / jobs.ts
CommitLineData
94a5ff8a
C
1import * as express from 'express'
2import { param } from 'express-validator/check'
3import { isValidJobState } from '../../helpers/custom-validators/jobs'
4import { logger } from '../../helpers/logger'
5import { areValidationErrors } from './utils'
6
7const listJobsValidator = [
8 param('state').custom(isValidJobState).not().isEmpty().withMessage('Should have a valid job state'),
9
10 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
11 logger.debug('Checking listJobsValidator parameters.', { parameters: req.params })
12
13 if (areValidationErrors(req, res)) return
14
15 return next()
16 }
17]
18
19// ---------------------------------------------------------------------------
20
21export {
22 listJobsValidator
23}