diff options
author | Chocobozzz <me@florianbigard.com> | 2019-12-04 14:49:59 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-12-04 14:49:59 +0100 |
commit | 1061c73fde3005100ead8764eacb444f240440d6 (patch) | |
tree | 0a548d7f0a9a548a52adf6d702dd589b04cd5ab0 /server/helpers | |
parent | 44df5c755c31798e64eba1ec41dd7e2d7ef50e56 (diff) | |
download | PeerTube-1061c73fde3005100ead8764eacb444f240440d6.tar.gz PeerTube-1061c73fde3005100ead8764eacb444f240440d6.tar.zst PeerTube-1061c73fde3005100ead8764eacb444f240440d6.zip |
Add ability to filter per job type
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 | } |