aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/job/job.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/job/job.ts')
-rw-r--r--server/models/job/job.ts9
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'
13import { JobState } from '../../../shared/models/job.model' 13import { JobCategory, JobState } from '../../../shared/models/job.model'
14 14
15let Job: Sequelize.Model<JobInstance, JobAttributes> 15let Job: Sequelize.Model<JobInstance, JobAttributes>
16let listWithLimitByCategory: JobMethods.ListWithLimitByCategory 16let 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
55listWithLimitByCategory = function (limit: number, state: JobState) { 55listWithLimitByCategory = 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