]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/custom-validators/jobs.ts
Refactor jobs state
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / jobs.ts
index 1cc6e6912b3668e02d9495329e7e8076506ae0d0..f6777ecd51610d6996a0fc6f90ef8763d6b352f1 100644 (file)
@@ -1,14 +1,21 @@
 import { JobState } from '../../../shared/models'
 import { exists } from './misc'
+import { jobTypes } from '@server/lib/job-queue/job-queue'
 
-const jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ]
+const jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed', 'paused' ]
 
 function isValidJobState (value: JobState) {
-  return exists(value) && jobStates.indexOf(value) !== -1
+  return exists(value) && jobStates.includes(value)
+}
+
+function isValidJobType (value: any) {
+  return exists(value) && jobTypes.includes(value)
 }
 
 // ---------------------------------------------------------------------------
 
 export {
-  isValidJobState
+  jobStates,
+  isValidJobState,
+  isValidJobType
 }