aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/custom-validators/jobs.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/server/helpers/custom-validators/jobs.ts b/server/helpers/custom-validators/jobs.ts
index 1cc6e6912..dd33e85a3 100644
--- a/server/helpers/custom-validators/jobs.ts
+++ b/server/helpers/custom-validators/jobs.ts
@@ -1,14 +1,20 @@
1import { JobState } from '../../../shared/models' 1import { JobState } from '../../../shared/models'
2import { exists } from './misc' 2import { exists } from './misc'
3import { jobTypes } from '@server/lib/job-queue/job-queue'
3 4
4const jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ] 5const jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ]
5 6
6function isValidJobState (value: JobState) { 7function isValidJobState (value: JobState) {
7 return exists(value) && jobStates.indexOf(value) !== -1 8 return exists(value) && jobStates.includes(value)
9}
10
11function isValidJobType (value: any) {
12 return exists(value) && jobTypes.includes(value)
8} 13}
9 14
10// --------------------------------------------------------------------------- 15// ---------------------------------------------------------------------------
11 16
12export { 17export {
13 isValidJobState 18 isValidJobState,
19 isValidJobType
14} 20}