File tree Expand file tree Collapse file tree 5 files changed +17
-9
lines changed
Expand file tree Collapse file tree 5 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ var collection;
1111var TaskMdl ;
1212var Task ;
1313var Roller ;
14- var utils ;
14+ var dbUtils ;
1515
1616var Fawn = {
1717 init : function ( db , _collection , options ) {
@@ -41,7 +41,7 @@ var Fawn = {
4141 TaskMdl = require ( "../models/task" ) ( mongoose , collection ) ;
4242 Task = require ( "./task" ) ( mongoose , TaskMdl ) ;
4343 Roller = require ( "./roller" ) ( mongoose , TaskMdl ) ;
44- utils = require ( "./utils/db.utils" ) ( mongoose ) ;
44+ dbUtils = require ( "./utils/db.utils" ) ( mongoose ) ;
4545 }
4646
4747 , Task : function ( ) {
@@ -56,7 +56,7 @@ var Fawn = {
5656
5757 , initModel : function ( modelName , schema ) {
5858 checkInitStatus ( ) ;
59- utils . initModel ( modelName , schema ) ;
59+ dbUtils . initModel ( modelName , schema ) ;
6060 }
6161} ;
6262
Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ var TaskProvider = function (_mongoose, _TaskMdl) {
5858 setModel = dbUtils . setModel ;
5959 getModel = dbUtils . getModel ;
6060
61+ goose . setDbUtils ( dbUtils ) ;
62+
6163 return Task ;
6264} ;
6365
Original file line number Diff line number Diff line change 44 */
55var constants = require ( "../constants" ) ;
66var utils = require ( "../utils/gen.utils" ) ;
7- var dbUtils = require ( "../utils/db.utils" ) ( ) ;
7+ var dbUtils ;
88
9- // utility functions
9+ // gen utility functions
1010var resolveFuture = utils . resolveFuture ;
1111var storeOldData = utils . storeOldData ;
1212var updateState = utils . updateState ;
1313var xcode = utils . xcode ;
14- var getModel = dbUtils . getModel ;
14+
15+ // db utility functions
16+ var getModel ;
1517
1618// constants
1719var PENDING = constants . PENDING ;
1820var DONE = constants . DONE ;
1921
22+ exports . setDbUtils = function ( _dbUtils ) {
23+ dbUtils = _dbUtils ;
24+ getModel = dbUtils . getModel ;
25+ } ;
26+
2027/**
2128 * This function handles the update step using
2229 * mongoose.
Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ var constants = require("../constants");
1111var mongoose ;
1212
1313module . exports = function ( _mongoose ) {
14- if ( ! mongoose ) mongoose = _mongoose || require ( "mongoose" ) ;
15-
14+ mongoose = _mongoose ;
1615 var Schema = mongoose . Schema ;
1716
1817 /**
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ global.mongoose = require("mongoose");
1818global . Grid = require ( "gridfs-stream" ) ;
1919Grid . mongo = mongoose . mongo ;
2020
21- global . dbUtils = require ( "../lib/utils/db.utils" ) ( ) ;
21+ global . dbUtils = require ( "../lib/utils/db.utils" ) ( mongoose ) ;
2222global . utils = require ( "../lib/utils/gen.utils" ) ;
2323global . expect = config . expect ;
2424global . Promise = config . Promise ;
You can’t perform that action at this time.
0 commit comments