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