Use req2params middleware for analisys node status endpoint

This commit is contained in:
Daniel García Aubert
2017-09-21 13:37:32 +02:00
parent 02cd6a43ad
commit 234576ab5f

View File

@@ -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) {