diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-14 17:31:26 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:51 +0100 |
commit | 350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad (patch) | |
tree | f4191f3c04a5230fcf8ca3d6ca3248643fc4151d /server/models/job/job.ts | |
parent | e34c85e527100c0b5c44567bd951e95be41b8d7e (diff) | |
download | PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.tar.gz PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.tar.zst PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.zip |
Follow works
Diffstat (limited to 'server/models/job/job.ts')
-rw-r--r-- | server/models/job/job.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/server/models/job/job.ts b/server/models/job/job.ts index ce1203e5a..c2d088090 100644 --- a/server/models/job/job.ts +++ b/server/models/job/job.ts | |||
@@ -10,7 +10,7 @@ import { | |||
10 | 10 | ||
11 | JobMethods | 11 | JobMethods |
12 | } from './job-interface' | 12 | } from './job-interface' |
13 | import { JobState } from '../../../shared/models/job.model' | 13 | import { JobCategory, JobState } from '../../../shared/models/job.model' |
14 | 14 | ||
15 | let Job: Sequelize.Model<JobInstance, JobAttributes> | 15 | let Job: Sequelize.Model<JobInstance, JobAttributes> |
16 | let listWithLimitByCategory: JobMethods.ListWithLimitByCategory | 16 | let listWithLimitByCategory: JobMethods.ListWithLimitByCategory |
@@ -38,7 +38,7 @@ export default function defineJob (sequelize: Sequelize.Sequelize, DataTypes: Se | |||
38 | { | 38 | { |
39 | indexes: [ | 39 | indexes: [ |
40 | { | 40 | { |
41 | fields: [ 'state' ] | 41 | fields: [ 'state', 'category' ] |
42 | } | 42 | } |
43 | ] | 43 | ] |
44 | } | 44 | } |
@@ -52,14 +52,15 @@ export default function defineJob (sequelize: Sequelize.Sequelize, DataTypes: Se | |||
52 | 52 | ||
53 | // --------------------------------------------------------------------------- | 53 | // --------------------------------------------------------------------------- |
54 | 54 | ||
55 | listWithLimitByCategory = function (limit: number, state: JobState) { | 55 | listWithLimitByCategory = function (limit: number, state: JobState, jobCategory: JobCategory) { |
56 | const query = { | 56 | const query = { |
57 | order: [ | 57 | order: [ |
58 | [ 'id', 'ASC' ] | 58 | [ 'id', 'ASC' ] |
59 | ], | 59 | ], |
60 | limit: limit, | 60 | limit: limit, |
61 | where: { | 61 | where: { |
62 | state | 62 | state, |
63 | category: jobCategory | ||
63 | } | 64 | } |
64 | } | 65 | } |
65 | 66 | ||