Windshaft-cartodb/lib/api/middlewares/layergroup-metadata.js

18 lines
888 B
JavaScript
Raw Normal View History

'use strict';
2018-03-28 20:06:23 +08:00
module.exports = function setMetadataToLayergroup (layergroupMetadata, includeQuery) {
return function setMetadataToLayergroupMiddleware (req, res, next) {
2018-06-22 23:31:45 +08:00
const { user, mapConfig, analysesResults = [], context, api_key: userApiKey } = res.locals;
2018-03-28 20:06:23 +08:00
const layergroup = res.body;
layergroupMetadata.addDataviewsAndWidgetsUrls(user, layergroup, mapConfig.obj());
layergroupMetadata.addAnalysesMetadata(user, layergroup, analysesResults, includeQuery);
layergroupMetadata.addTurboCartoContextMetadata(layergroup, mapConfig.obj(), context);
layergroupMetadata.addAggregationContextMetadata(layergroup, mapConfig.obj(), context);
2019-10-22 01:07:24 +08:00
layergroupMetadata.addDateWrappingMetadata(layergroup, mapConfig.obj());
2018-06-22 23:31:45 +08:00
layergroupMetadata.addTileJsonMetadata(layergroup, user, mapConfig, userApiKey);
2018-03-28 20:06:23 +08:00
next();
};
};