Implement multiple layer date wrapping

This commit is contained in:
IagoLast 2018-06-05 09:34:44 +02:00
parent 7df1a19da4
commit 9ee6d7fc91

View File

@ -28,12 +28,17 @@ class VectorMapConfigAdapter {
}
_wrapDates(requestMapConfig, user) {
const originalQuery = requestMapConfig.layers[0].options.sql;
return Promise.all(requestMapConfig.layers.map(layer => this._wrapLayer(layer, user)))
.then(() => requestMapConfig);
}
_wrapLayer(layer, user) {
const originalQuery = layer.options.sql;
return this._getColumns(user, originalQuery)
.then(result => {
const newSqlQuery = dateWrapper.wrapDates(originalQuery, result.fields);
requestMapConfig.layers[0].options.sql = newSqlQuery;
return requestMapConfig;
layer.options.sql = newSqlQuery;
return layer;
});
}