1
0
Fork 0
peertube/server/helpers/custom-validators/jobs.ts

21 lines
551 B
TypeScript
Raw Normal View History

import { JobState } from '../../../shared/models'
import { exists } from './misc'
2019-12-04 08:49:59 -05:00
import { jobTypes } from '@server/lib/job-queue/job-queue'
2018-07-10 11:02:20 -04:00
const jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed' ]
function isValidJobState (value: JobState) {
2019-12-04 08:49:59 -05:00
return exists(value) && jobStates.includes(value)
}
function isValidJobType (value: any) {
return exists(value) && jobTypes.includes(value)
}
// ---------------------------------------------------------------------------
export {
2019-12-04 08:49:59 -05:00
isValidJobState,
isValidJobType
}