Build afterLayergroupCreate middleware as an array of middlewares instead of preforming all them as one middleware
This commit is contained in:
@@ -299,72 +299,25 @@ function respond (req, res) {
|
||||
}
|
||||
|
||||
MapController.prototype.afterLayergroupCreateBuilder = function (options = {}) {
|
||||
const self = this;
|
||||
const {
|
||||
useTemplateHash = false,
|
||||
includeQuery = false
|
||||
} = options;
|
||||
|
||||
return function (req, res, callback) {
|
||||
step(
|
||||
function incrementMapViewCount () {
|
||||
self.incrementMapViewCount(req, res, this);
|
||||
},
|
||||
function augmentLayergroupData (err) {
|
||||
assert.ifError(err);
|
||||
self.augmentLayergroupData(req, res, this);
|
||||
},
|
||||
function getAffectedTables (err) {
|
||||
assert.ifError(err);
|
||||
self.getAffectedTables(req, res, this);
|
||||
},
|
||||
function setCacheChannel (err) {
|
||||
assert.ifError(err);
|
||||
self.setCacheChannel(req, res, this);
|
||||
},
|
||||
function setLastUpdatedTime (err) {
|
||||
assert.ifError(err);
|
||||
self.setLastUpdatedTimeToLayergroup(req, res, this);
|
||||
},
|
||||
function setCacheControl (err) {
|
||||
assert.ifError(err);
|
||||
self.setCacheControl(req, res, this);
|
||||
},
|
||||
function setLayerStats (err) {
|
||||
assert.ifError(err);
|
||||
self.setLayerStats(req, res, this);
|
||||
},
|
||||
function setLayergroupIdHeader (err) {
|
||||
assert.ifError(err);
|
||||
|
||||
const setLayergroupIdHeader = self.setLayergroupIdHeaderBuilder(useTemplateHash);
|
||||
|
||||
setLayergroupIdHeader(req, res, this);
|
||||
},
|
||||
function (err) {
|
||||
assert.ifError(err);
|
||||
self.setDataviewsAndWidgetsUrlsToLayergroupMetadata(req, res, this);
|
||||
},
|
||||
function setAnalysesMetadataToLayergroup(err) {
|
||||
assert.ifError(err);
|
||||
|
||||
const setAnalysesMetadataToLayergroup = self.setAnalysesMetadataToLayergroupBuilder(includeQuery);
|
||||
|
||||
setAnalysesMetadataToLayergroup(req, res, this);
|
||||
},
|
||||
function setTurboCartoMetadataToLayergroup (err) {
|
||||
assert.ifError(err);
|
||||
self.setTurboCartoMetadataToLayergroup(req, res, this);
|
||||
},
|
||||
function setSurrogateKeyHeader (err) {
|
||||
assert.ifError(err);
|
||||
self.setSurrogateKeyHeader(req, res, this);
|
||||
},
|
||||
function finish(err) {
|
||||
callback(err);
|
||||
}
|
||||
);
|
||||
};
|
||||
return [
|
||||
this.incrementMapViewCount.bind(this),
|
||||
this.augmentLayergroupData.bind(this),
|
||||
this.getAffectedTables.bind(this),
|
||||
this.setCacheChannel.bind(this),
|
||||
this.setLastUpdatedTimeToLayergroup.bind(this),
|
||||
this.setCacheControl.bind(this),
|
||||
this.setLayerStats.bind(this),
|
||||
this.setLayergroupIdHeaderBuilder(useTemplateHash),
|
||||
this.setDataviewsAndWidgetsUrlsToLayergroupMetadata.bind(this),
|
||||
this.setAnalysesMetadataToLayergroupBuilder(includeQuery),
|
||||
this.setTurboCartoMetadataToLayergroup.bind(this),
|
||||
this.setSurrogateKeyHeader.bind(this)
|
||||
];
|
||||
};
|
||||
|
||||
MapController.prototype.incrementMapViewCount = function (req, res, callback) {
|
||||
|
||||
Reference in New Issue
Block a user