]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/helpers/custom-validators/jobs.ts
emit more specific status codes on video upload (#3423)
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / jobs.ts
1 import { JobState } from '../../../shared/models'
2 import { exists } from './misc'
3 import { jobTypes } from '@server/lib/job-queue/job-queue'
4
5 const jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ]
6
7 function isValidJobState (value: JobState) {
8 return exists(value) && jobStates.includes(value)
9 }
10
11 function isValidJobType (value: any) {
12 return exists(value) && jobTypes.includes(value)
13 }
14
15 // ---------------------------------------------------------------------------
16
17 export {
18 isValidJobState,
19 isValidJobType
20 }