diff options
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/custom-validators/jobs.ts | 10 |
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 @@ | |||
1 | import { JobState } from '../../../shared/models' | 1 | import { JobState } from '../../../shared/models' |
2 | import { exists } from './misc' | 2 | import { exists } from './misc' |
3 | import { jobTypes } from '@server/lib/job-queue/job-queue' | ||
3 | 4 | ||
4 | const jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ] | 5 | const jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ] |
5 | 6 | ||
6 | function isValidJobState (value: JobState) { | 7 | function isValidJobState (value: JobState) { |
7 | return exists(value) && jobStates.indexOf(value) !== -1 | 8 | return exists(value) && jobStates.includes(value) |
9 | } | ||
10 | |||
11 | function isValidJobType (value: any) { | ||
12 | return exists(value) && jobTypes.includes(value) | ||
8 | } | 13 | } |
9 | 14 | ||
10 | // --------------------------------------------------------------------------- | 15 | // --------------------------------------------------------------------------- |
11 | 16 | ||
12 | export { | 17 | export { |
13 | isValidJobState | 18 | isValidJobState, |
19 | isValidJobType | ||
14 | } | 20 | } |