2017-05-22 20:58:25 +02:00
|
|
|
import * as Sequelize from 'sequelize'
|
2017-07-05 13:26:25 +02:00
|
|
|
import * as Promise from 'bluebird'
|
2017-05-22 20:58:25 +02:00
|
|
|
|
2017-11-09 17:51:58 +01:00
|
|
|
import { JobCategory, JobState } from '../../../shared/models/job.model'
|
2017-06-16 10:36:18 +02:00
|
|
|
|
2017-05-22 20:58:25 +02:00
|
|
|
export namespace JobMethods {
|
2017-11-09 17:51:58 +01:00
|
|
|
export type ListWithLimitByCategory = (limit: number, state: JobState, category: JobCategory) => Promise<JobInstance[]>
|
2017-05-22 20:58:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface JobClass {
|
2017-11-09 17:51:58 +01:00
|
|
|
listWithLimitByCategory: JobMethods.ListWithLimitByCategory
|
2017-05-22 20:58:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface JobAttributes {
|
2017-06-16 10:36:18 +02:00
|
|
|
state: JobState
|
2017-05-22 20:58:25 +02:00
|
|
|
handlerName: string
|
2017-11-10 17:27:49 +01:00
|
|
|
handlerInputData: any
|
2017-05-22 20:58:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface JobInstance extends JobClass, JobAttributes, Sequelize.Instance<JobAttributes> {
|
|
|
|
id: number
|
|
|
|
createdAt: Date
|
|
|
|
updatedAt: Date
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface JobModel extends JobClass, Sequelize.Model<JobInstance, JobAttributes> {}
|