Extract getAffectedTables middleware from controller's context

This commit is contained in:
Daniel García Aubert
2018-03-14 13:01:07 +01:00
parent 7598e6ab4b
commit 35a3219012
+4 -4
View File
@@ -52,7 +52,7 @@ NamedMapsController.prototype.register = function(app) {
userMiddleware(),
this.prepareContext,
getNamedMapProvider(tileOptions),
this.getAffectedTables(),
getAffectedTables(),
this.getTile(tileOptions),
this.setSurrogateKey(),
this.setCacheChannelHeader(),
@@ -76,7 +76,7 @@ NamedMapsController.prototype.register = function(app) {
allowQueryParams(['layer', 'zoom', 'lon', 'lat', 'bbox']),
this.prepareContext,
getNamedMapProvider(staticOptions),
this.getAffectedTables(),
getAffectedTables(),
this.getTemplate(staticOptions),
this.prepareLayerFilterFromPreviewLayers(staticOptions),
this.getStaticImageOptions(),
@@ -117,7 +117,7 @@ function getNamedMapProvider ({ namedMapProviderCache, label, forcedFormat = nul
};
};
NamedMapsController.prototype.getAffectedTables = function () {
function getAffectedTables () {
return function getAffectedTables (req, res, next) {
const { namedMapProvider } = res.locals;
@@ -132,7 +132,7 @@ NamedMapsController.prototype.getAffectedTables = function () {
next();
});
}.bind(this);
};
};
NamedMapsController.prototype.getTemplate = function ({ label }) {