Use objects instead of param list
This commit is contained in:
@@ -28,7 +28,7 @@ NamedMapsAdminController.prototype.register = function (app) {
|
||||
credentialsMiddleware(),
|
||||
checkContentType({ action: 'POST', label: 'POST TEMPLATE' }),
|
||||
authorizedByAPIKey({ authApi: this.authApi, action: 'create', label: 'POST TEMPLATE' }),
|
||||
createTemplate(this.templateMaps),
|
||||
createTemplate({ templateMaps: this.templateMaps }),
|
||||
sendResponse()
|
||||
);
|
||||
|
||||
@@ -40,7 +40,7 @@ NamedMapsAdminController.prototype.register = function (app) {
|
||||
credentialsMiddleware(),
|
||||
checkContentType({ action: 'PUT', label: 'PUT TEMPLATE' }),
|
||||
authorizedByAPIKey({ authApi: this.authApi, action: 'update', label: 'PUT TEMPLATE' }),
|
||||
updateTemplate(this.templateMaps),
|
||||
updateTemplate({ templateMaps: this.templateMaps }),
|
||||
sendResponse()
|
||||
);
|
||||
|
||||
@@ -51,7 +51,7 @@ NamedMapsAdminController.prototype.register = function (app) {
|
||||
localsMiddleware(),
|
||||
credentialsMiddleware(),
|
||||
authorizedByAPIKey({ authApi: this.authApi, action: 'get', label: 'GET TEMPLATE' }),
|
||||
retrieveTemplate(this.templateMaps),
|
||||
retrieveTemplate({ templateMaps: this.templateMaps }),
|
||||
sendResponse()
|
||||
);
|
||||
|
||||
@@ -62,7 +62,7 @@ NamedMapsAdminController.prototype.register = function (app) {
|
||||
localsMiddleware(),
|
||||
credentialsMiddleware(),
|
||||
authorizedByAPIKey({ authApi: this.authApi, action: 'delete', label: 'DELETE TEMPLATE' }),
|
||||
destroyTemplate(this.templateMaps),
|
||||
destroyTemplate({ templateMaps: this.templateMaps }),
|
||||
sendResponse()
|
||||
);
|
||||
|
||||
@@ -73,7 +73,7 @@ NamedMapsAdminController.prototype.register = function (app) {
|
||||
localsMiddleware(),
|
||||
credentialsMiddleware(),
|
||||
authorizedByAPIKey({ authApi: this.authApi, action: 'list', label: 'GET TEMPLATE LIST' }),
|
||||
listTemplates(this.templateMaps),
|
||||
listTemplates({ templateMaps: this.templateMaps }),
|
||||
sendResponse()
|
||||
);
|
||||
|
||||
@@ -116,7 +116,7 @@ function authorizedByAPIKey ({ authApi, action, label }) {
|
||||
};
|
||||
}
|
||||
|
||||
function createTemplate (templateMaps) {
|
||||
function createTemplate ({ templateMaps }) {
|
||||
return function createTemplateMiddleware (req, res, next) {
|
||||
const { user } = res.locals;
|
||||
const template = req.body;
|
||||
@@ -133,7 +133,7 @@ function createTemplate (templateMaps) {
|
||||
};
|
||||
}
|
||||
|
||||
function updateTemplate (templateMaps) {
|
||||
function updateTemplate ({ templateMaps }) {
|
||||
return function updateTemplateMiddleware (req, res, next) {
|
||||
const { user } = res.locals;
|
||||
const template = req.body;
|
||||
@@ -151,7 +151,7 @@ function updateTemplate (templateMaps) {
|
||||
};
|
||||
}
|
||||
|
||||
function retrieveTemplate (templateMaps) {
|
||||
function retrieveTemplate ({ templateMaps }) {
|
||||
return function retrieveTemplateMiddleware (req, res, next) {
|
||||
req.profiler.start('windshaft-cartodb.get_template');
|
||||
|
||||
@@ -179,7 +179,7 @@ function retrieveTemplate (templateMaps) {
|
||||
};
|
||||
}
|
||||
|
||||
function destroyTemplate (templateMaps) {
|
||||
function destroyTemplate ({ templateMaps }) {
|
||||
return function destroyTemplateMiddleware (req, res, next) {
|
||||
req.profiler.start('windshaft-cartodb.delete_template');
|
||||
|
||||
@@ -199,7 +199,7 @@ function destroyTemplate (templateMaps) {
|
||||
};
|
||||
}
|
||||
|
||||
function listTemplates (templateMaps) {
|
||||
function listTemplates ({ templateMaps }) {
|
||||
return function listTemplatesMiddleware (req, res, next) {
|
||||
req.profiler.start('windshaft-cartodb.get_template_list');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user