diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-30 10:51:13 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-30 10:55:06 +0100 |
commit | 5cd80545422bba855cc9a730a2e13cc9d982c34b (patch) | |
tree | 9a60cd7c9218c296a1460938d11e3bce784f7cc0 /server/models/job/job-interface.ts | |
parent | 1f3e9feca2caf68024168b0ea9ed39d8438fa235 (diff) | |
download | PeerTube-5cd80545422bba855cc9a730a2e13cc9d982c34b.tar.gz PeerTube-5cd80545422bba855cc9a730a2e13cc9d982c34b.tar.zst PeerTube-5cd80545422bba855cc9a730a2e13cc9d982c34b.zip |
Add ability to list jobs
Diffstat (limited to 'server/models/job/job-interface.ts')
-rw-r--r-- | server/models/job/job-interface.ts | 15 |
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 @@ | |||
1 | import * as Bluebird from 'bluebird' | ||
1 | import * as Sequelize from 'sequelize' | 2 | import * as Sequelize from 'sequelize' |
2 | import * as Promise from 'bluebird' | 3 | import { Job as FormattedJob, JobCategory, JobState } from '../../../shared/models/job.model' |
3 | 4 | import { ResultList } from '../../../shared/models/result-list.model' | |
4 | import { JobCategory, JobState } from '../../../shared/models/job.model' | ||
5 | 5 | ||
6 | export namespace JobMethods { | 6 | export 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 | ||
10 | export interface JobClass { | 13 | export interface JobClass { |
11 | listWithLimitByCategory: JobMethods.ListWithLimitByCategory | 14 | listWithLimitByCategory: JobMethods.ListWithLimitByCategory |
15 | listForApi: JobMethods.ListForApi, | ||
12 | } | 16 | } |
13 | 17 | ||
14 | export interface JobAttributes { | 18 | export 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 | ||
26 | export interface JobModel extends JobClass, Sequelize.Model<JobInstance, JobAttributes> {} | 33 | export interface JobModel extends JobClass, Sequelize.Model<JobInstance, JobAttributes> {} |