X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fjobs.ts;h=f6777ecd51610d6996a0fc6f90ef8763d6b352f1;hb=402145b8630d1908c35f8c22846ddc4475f25d3e;hp=1cc6e6912b3668e02d9495329e7e8076506ae0d0;hpb=94831479f5facff9469540a3d49dd347b88bdf5a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/jobs.ts b/server/helpers/custom-validators/jobs.ts index 1cc6e6912..f6777ecd5 100644 --- a/server/helpers/custom-validators/jobs.ts +++ b/server/helpers/custom-validators/jobs.ts @@ -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 }