Pass only required params

This commit is contained in:
Daniel García Aubert
2018-03-14 17:08:04 +01:00
parent 091efe52fc
commit a8d31d52cf
+15 -19
View File
@@ -41,20 +41,20 @@ function NamedMapsController(prepareContext, namedMapProviderCache, tileBackend,
module.exports = NamedMapsController;
NamedMapsController.prototype.register = function(app) {
const tileOptions = {
namedMapProviderCache: this.namedMapProviderCache,
tileBackend: this.tileBackend,
label: 'NAMED_MAP_TILE'
};
app.get(
app.base_url_templated + '/:template_id/:layer/:z/:x/:y.(:format)',
cors(),
userMiddleware(),
this.prepareContext,
getNamedMapProvider(tileOptions),
getNamedMapProvider({
namedMapProviderCache: this.namedMapProviderCache,
label: 'NAMED_MAP_TILE'
}),
getAffectedTables(),
getTile(tileOptions),
getTile({
tileBackend: this.tileBackend,
label: 'NAMED_MAP_TILE'
}),
setSurrogateKeyHeader({ surrogateKeysCache: this.surrogateKeysCache }),
setCacheChannelHeader(),
setLastModifiedHeader(),
@@ -64,25 +64,21 @@ NamedMapsController.prototype.register = function(app) {
vectorError()
);
const staticOptions = {
previewBackend: this.previewBackend,
namedMapProviderCache: this.namedMapProviderCache,
forcedFormat: 'png',
label: 'STATIC_VIZ_MAP'
};
app.get(
app.base_url_mapconfig + '/static/named/:template_id/:width/:height.:format',
cors(),
userMiddleware(),
allowQueryParams(['layer', 'zoom', 'lon', 'lat', 'bbox']),
this.prepareContext,
getNamedMapProvider(staticOptions),
getNamedMapProvider({ previewBackend: this.previewBackend, label: 'STATIC_VIZ_MAP', forcedFormat: 'png' }),
getAffectedTables(),
getTemplate(staticOptions),
prepareLayerFilterFromPreviewLayers(staticOptions),
getTemplate({ label: 'STATIC_VIZ_MAP' }),
prepareLayerFilterFromPreviewLayers({
namedMapProviderCache: this.namedMapProviderCache,
label: 'STATIC_VIZ_MAP'
}),
getStaticImageOptions({ tablesExtentApi: this.tablesExtentApi }),
getImage(staticOptions),
getImage({ previewBackend: this.previewBackend, label: 'STATIC_VIZ_MAP' }),
incrementMapViews({ metadataBackend: this.metadataBackend }),
setSurrogateKeyHeader({ surrogateKeysCache: this.surrogateKeysCache }),
setCacheChannelHeader(),