aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/job/job-interface.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/job/job-interface.ts')
-rw-r--r--server/models/job/job-interface.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/server/models/job/job-interface.ts b/server/models/job/job-interface.ts
index 411a05029..3cfc0fbed 100644
--- a/server/models/job/job-interface.ts
+++ b/server/models/job/job-interface.ts
@@ -1,18 +1,23 @@
1import * as Bluebird from 'bluebird'
1import * as Sequelize from 'sequelize' 2import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 3import { Job as FormattedJob, JobCategory, JobState } from '../../../shared/models/job.model'
3 4import { ResultList } from '../../../shared/models/result-list.model'
4import { JobCategory, JobState } from '../../../shared/models/job.model'
5 5
6export namespace JobMethods { 6export namespace JobMethods {
7 export type ListWithLimitByCategory = (limit: number, state: JobState, category: JobCategory) => Promise<JobInstance[]> 7 export type ListWithLimitByCategory = (limit: number, state: JobState, category: JobCategory) => Bluebird<JobInstance[]>
8 export type ListForApi = (start: number, count: number, sort: string) => Bluebird< ResultList<JobInstance> >
9
10 export type ToFormattedJSON = (this: JobInstance) => FormattedJob
8} 11}
9 12
10export interface JobClass { 13export interface JobClass {
11 listWithLimitByCategory: JobMethods.ListWithLimitByCategory 14 listWithLimitByCategory: JobMethods.ListWithLimitByCategory
15 listForApi: JobMethods.ListForApi,
12} 16}
13 17
14export interface JobAttributes { 18export interface JobAttributes {
15 state: JobState 19 state: JobState
20 category: JobCategory
16 handlerName: string 21 handlerName: string
17 handlerInputData: any 22 handlerInputData: any
18} 23}
@@ -21,6 +26,8 @@ export interface JobInstance extends JobClass, JobAttributes, Sequelize.Instance
21 id: number 26 id: number
22 createdAt: Date 27 createdAt: Date
23 updatedAt: Date 28 updatedAt: Date
29
30 toFormattedJSON: JobMethods.ToFormattedJSON
24} 31}
25 32
26export interface JobModel extends JobClass, Sequelize.Model<JobInstance, JobAttributes> {} 33export interface JobModel extends JobClass, Sequelize.Model<JobInstance, JobAttributes> {}