diff options
Diffstat (limited to 'server/models/job.js')
-rw-r--r-- | server/models/job.js | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/server/models/job.js b/server/models/job.js deleted file mode 100644 index 949f88d44..000000000 --- a/server/models/job.js +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | const values = require('lodash/values') | ||
4 | |||
5 | const constants = require('../initializers/constants') | ||
6 | |||
7 | // --------------------------------------------------------------------------- | ||
8 | |||
9 | module.exports = function (sequelize, DataTypes) { | ||
10 | const Job = sequelize.define('Job', | ||
11 | { | ||
12 | state: { | ||
13 | type: DataTypes.ENUM(values(constants.JOB_STATES)), | ||
14 | allowNull: false | ||
15 | }, | ||
16 | handlerName: { | ||
17 | type: DataTypes.STRING, | ||
18 | allowNull: false | ||
19 | }, | ||
20 | handlerInputData: { | ||
21 | type: DataTypes.JSON, | ||
22 | allowNull: true | ||
23 | } | ||
24 | }, | ||
25 | { | ||
26 | indexes: [ | ||
27 | { | ||
28 | fields: [ 'state' ] | ||
29 | } | ||
30 | ], | ||
31 | classMethods: { | ||
32 | listWithLimit | ||
33 | } | ||
34 | } | ||
35 | ) | ||
36 | |||
37 | return Job | ||
38 | } | ||
39 | |||
40 | // --------------------------------------------------------------------------- | ||
41 | |||
42 | function listWithLimit (limit, state, callback) { | ||
43 | const query = { | ||
44 | order: [ | ||
45 | [ 'id', 'ASC' ] | ||
46 | ], | ||
47 | limit: limit, | ||
48 | where: { | ||
49 | state | ||
50 | } | ||
51 | } | ||
52 | |||
53 | return this.findAll(query).asCallback(callback) | ||
54 | } | ||