diff --git a/lib/cartodb/controllers/layergroup.js b/lib/cartodb/controllers/layergroup.js index 6309b5f1..9f2a95e7 100644 --- a/lib/cartodb/controllers/layergroup.js +++ b/lib/cartodb/controllers/layergroup.js @@ -15,6 +15,8 @@ var MapStoreMapConfigProvider = require('../models/mapconfig/provider/map-store- var QueryTables = require('cartodb-query-tables'); +const req2paramsMiddleware = require('../middleware/req2params-middleware'); + /** * @param {AuthApi} authApi * @param {PgConnection} pgConnection @@ -43,6 +45,8 @@ function LayergroupController(authApi, pgConnection, mapStore, tileBackend, prev this.dataviewBackend = new DataviewBackend(analysisBackend); this.analysisStatusBackend = new AnalysisStatusBackend(); + + this.req2paramsMiddleware = req2paramsMiddleware(authApi, pgConnection); } util.inherits(LayergroupController, BaseController); @@ -126,19 +130,19 @@ LayergroupController.prototype.register = function(app) { ); app.get(app.base_url_mapconfig + - '/:token/analysis/node/:nodeId', cors(), userMiddleware, - this.analysisNodeStatus.bind(this)); + '/:token/analysis/node/:nodeId', + cors(), + userMiddleware, + this.req2paramsMiddleware, + this.analysisNodeStatus.bind(this) + ); }; LayergroupController.prototype.analysisNodeStatus = function(req, res, next) { var self = this; step( - function setupParams() { - self.req2params(req, res, this); - }, - function retrieveNodeStatus(err) { - assert.ifError(err); + function retrieveNodeStatus() { self.analysisStatusBackend.getNodeStatus(req.params, this); }, function finish(err, nodeStatus, stats) {