]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/jobs.ts
Translated using Weblate (Arabic)
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / jobs.ts
index 0fc183c1af9267b4c05d9c7ea6a40c11c65b572e..99ef25e0a1a448b8af74cf6c7b0a1c88d44d166c 100644 (file)
@@ -5,6 +5,10 @@ import { logger } from '../../helpers/logger'
 import { areValidationErrors } from './utils'
 
 const listJobsValidator = [
+  param('state')
+  .optional()
+  .custom(isValidJobState).not().isEmpty().withMessage('Should have a valid job state'),
+
   query('jobType')
     .optional()
     .custom(isValidJobType).withMessage('Should have a valid job state'),
@@ -18,22 +22,8 @@ const listJobsValidator = [
   }
 ]
 
-const listJobsStateValidator = [
-  param('state')
-    .custom(isValidJobState).not().isEmpty().withMessage('Should have a valid job state'),
-
-  (req: express.Request, res: express.Response, next: express.NextFunction) => {
-    logger.debug('Checking listJobsValidator parameters.', { parameters: req.params })
-
-    if (areValidationErrors(req, res)) return
-
-    return next()
-  }
-]
-
 // ---------------------------------------------------------------------------
 
 export {
-  listJobsValidator,
-  listJobsStateValidator
+  listJobsValidator
 }