aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/jobs.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-12-13 19:27:25 +0100
committerRigel Kent <sendmemail@rigelk.eu>2020-12-13 19:27:25 +0100
commit040d6896a3cd5622e78cccdedd8cce2afcf49a31 (patch)
tree1c4a1503e1886ce411e008fd0b367ef0d12088e9 /server/middlewares/validators/jobs.ts
parent7aebd32f8396827012aab5ea196158606c0611e3 (diff)
downloadPeerTube-040d6896a3cd5622e78cccdedd8cce2afcf49a31.tar.gz
PeerTube-040d6896a3cd5622e78cccdedd8cce2afcf49a31.tar.zst
PeerTube-040d6896a3cd5622e78cccdedd8cce2afcf49a31.zip
add display of logs matching any state
Diffstat (limited to 'server/middlewares/validators/jobs.ts')
-rw-r--r--server/middlewares/validators/jobs.ts18
1 files changed, 15 insertions, 3 deletions
diff --git a/server/middlewares/validators/jobs.ts b/server/middlewares/validators/jobs.ts
index b57615dbc..0fc183c1a 100644
--- a/server/middlewares/validators/jobs.ts
+++ b/server/middlewares/validators/jobs.ts
@@ -5,8 +5,6 @@ import { logger } from '../../helpers/logger'
5import { areValidationErrors } from './utils' 5import { areValidationErrors } from './utils'
6 6
7const listJobsValidator = [ 7const listJobsValidator = [
8 param('state')
9 .custom(isValidJobState).not().isEmpty().withMessage('Should have a valid job state'),
10 query('jobType') 8 query('jobType')
11 .optional() 9 .optional()
12 .custom(isValidJobType).withMessage('Should have a valid job state'), 10 .custom(isValidJobType).withMessage('Should have a valid job state'),
@@ -20,8 +18,22 @@ const listJobsValidator = [
20 } 18 }
21] 19]
22 20
21const listJobsStateValidator = [
22 param('state')
23 .custom(isValidJobState).not().isEmpty().withMessage('Should have a valid job state'),
24
25 (req: express.Request, res: express.Response, next: express.NextFunction) => {
26 logger.debug('Checking listJobsValidator parameters.', { parameters: req.params })
27
28 if (areValidationErrors(req, res)) return
29
30 return next()
31 }
32]
33
23// --------------------------------------------------------------------------- 34// ---------------------------------------------------------------------------
24 35
25export { 36export {
26 listJobsValidator 37 listJobsValidator,
38 listJobsStateValidator
27} 39}