]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - 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
CommitLineData
94a5ff8a
C
1import { JobState } from '../../../shared/models'
2import { exists } from './misc'
1061c73f 3import { jobTypes } from '@server/lib/job-queue/job-queue'
94a5ff8a 4
94831479 5const jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ]
94a5ff8a
C
6
7function isValidJobState (value: JobState) {
1061c73f
C
8 return exists(value) && jobStates.includes(value)
9}
10
11function isValidJobType (value: any) {
12 return exists(value) && jobTypes.includes(value)
94a5ff8a
C
13}
14
15// ---------------------------------------------------------------------------
16
17export {
1061c73f
C
18 isValidJobState,
19 isValidJobType
94a5ff8a 20}