Moved job models to its own namespace
This commit is contained in:
parent
6acc02e998
commit
ef9dfae189
@ -1,9 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var JobSimple = require('./job_simple');
|
||||
var JobMultiple = require('./job_multiple');
|
||||
var JobFallback = require('./job_fallback');
|
||||
var jobClasses = [ JobSimple, JobMultiple, JobFallback ];
|
||||
var jobModels = require('./models');
|
||||
|
||||
function JobFactory() {
|
||||
}
|
||||
@ -15,9 +12,9 @@ JobFactory.create = function (data) {
|
||||
throw new Error('You must indicate a valid SQL');
|
||||
}
|
||||
|
||||
for (var i = 0; i < jobClasses.length; i++) {
|
||||
if (jobClasses[i].is(data.query)) {
|
||||
return new jobClasses[i](data);
|
||||
for (var i = 0; i < jobModels.length; i++) {
|
||||
if (jobModels[i].is(data.query)) {
|
||||
return new jobModels[i](data);
|
||||
}
|
||||
}
|
||||
|
||||
|
7
batch/models/index.js
Normal file
7
batch/models/index.js
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var JobSimple = require('./job_simple');
|
||||
var JobMultiple = require('./job_multiple');
|
||||
var JobFallback = require('./job_fallback');
|
||||
|
||||
module.exports = [ JobSimple, JobMultiple, JobFallback ];
|
@ -2,7 +2,7 @@
|
||||
|
||||
var assert = require('assert');
|
||||
var uuid = require('node-uuid');
|
||||
var jobStatus = require('./job_status');
|
||||
var jobStatus = require('../job_status');
|
||||
var validStatusTransitions = [
|
||||
[jobStatus.PENDING, jobStatus.RUNNING],
|
||||
[jobStatus.PENDING, jobStatus.CANCELLED],
|
@ -2,7 +2,7 @@
|
||||
|
||||
var util = require('util');
|
||||
var JobBase = require('./job_base');
|
||||
var jobStatus = require('./job_status');
|
||||
var jobStatus = require('../job_status');
|
||||
|
||||
function JobFallback(data) {
|
||||
JobBase.call(this, data);
|
@ -2,7 +2,7 @@
|
||||
|
||||
var util = require('util');
|
||||
var JobBase = require('./job_base');
|
||||
var jobStatus = require('./job_status');
|
||||
var jobStatus = require('../job_status');
|
||||
|
||||
function JobMultiple(data) {
|
||||
JobBase.call(this, data);
|
@ -2,7 +2,7 @@
|
||||
|
||||
var util = require('util');
|
||||
var JobBase = require('./job_base');
|
||||
var jobStatus = require('./job_status');
|
||||
var jobStatus = require('../job_status');
|
||||
|
||||
function JobSimple(data) {
|
||||
JobBase.call(this, data);
|
Loading…
Reference in New Issue
Block a user