aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-04 14:49:59 +0100
committerChocobozzz <me@florianbigard.com>2019-12-04 14:49:59 +0100
commit1061c73fde3005100ead8764eacb444f240440d6 (patch)
tree0a548d7f0a9a548a52adf6d702dd589b04cd5ab0 /server/helpers
parent44df5c755c31798e64eba1ec41dd7e2d7ef50e56 (diff)
downloadPeerTube-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.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}