2018-01-25 09:05:18 -05:00
|
|
|
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-01-25 09:05:18 -05:00
|
|
|
|
2020-12-14 06:00:35 -05:00
|
|
|
const jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed', 'paused' ]
|
2018-01-25 09:05:18 -05:00
|
|
|
|
|
|
|
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)
|
2018-01-25 09:05:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
2020-12-13 13:27:25 -05:00
|
|
|
jobStates,
|
2019-12-04 08:49:59 -05:00
|
|
|
isValidJobState,
|
|
|
|
isValidJobType
|
2018-01-25 09:05:18 -05:00
|
|
|
}
|