Rename user limits api by user limits backend
This commit is contained in:
@@ -9,10 +9,10 @@ const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
|
||||
* @param {TemplateMaps} templateMaps
|
||||
* @constructor
|
||||
*/
|
||||
function AdminTemplateController(authBackend, templateMaps, userLimitsApi) {
|
||||
function AdminTemplateController(authBackend, templateMaps, userLimitsBackend) {
|
||||
this.authBackend = authBackend;
|
||||
this.templateMaps = templateMaps;
|
||||
this.userLimitsApi = userLimitsApi;
|
||||
this.userLimitsBackend = userLimitsBackend;
|
||||
}
|
||||
|
||||
module.exports = AdminTemplateController;
|
||||
@@ -24,7 +24,7 @@ AdminTemplateController.prototype.register = function (templateRouter) {
|
||||
`/`,
|
||||
credentials(),
|
||||
authorizedByAPIKey({ authBackend: this.authBackend, action: 'create', label: 'POST TEMPLATE' }),
|
||||
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_CREATE),
|
||||
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_CREATE),
|
||||
checkContentType({ action: 'POST', label: 'POST TEMPLATE' }),
|
||||
createTemplate({ templateMaps: this.templateMaps })
|
||||
);
|
||||
@@ -33,7 +33,7 @@ AdminTemplateController.prototype.register = function (templateRouter) {
|
||||
`/:template_id`,
|
||||
credentials(),
|
||||
authorizedByAPIKey({ authBackend: this.authBackend, action: 'update', label: 'PUT TEMPLATE' }),
|
||||
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_UPDATE),
|
||||
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_UPDATE),
|
||||
checkContentType({ action: 'PUT', label: 'PUT TEMPLATE' }),
|
||||
updateTemplate({ templateMaps: this.templateMaps })
|
||||
);
|
||||
@@ -42,7 +42,7 @@ AdminTemplateController.prototype.register = function (templateRouter) {
|
||||
`/:template_id`,
|
||||
credentials(),
|
||||
authorizedByAPIKey({ authBackend: this.authBackend, action: 'get', label: 'GET TEMPLATE' }),
|
||||
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_GET),
|
||||
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_GET),
|
||||
retrieveTemplate({ templateMaps: this.templateMaps })
|
||||
);
|
||||
|
||||
@@ -50,7 +50,7 @@ AdminTemplateController.prototype.register = function (templateRouter) {
|
||||
`/:template_id`,
|
||||
credentials(),
|
||||
authorizedByAPIKey({ authBackend: this.authBackend, action: 'delete', label: 'DELETE TEMPLATE' }),
|
||||
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_DELETE),
|
||||
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_DELETE),
|
||||
destroyTemplate({ templateMaps: this.templateMaps })
|
||||
);
|
||||
|
||||
@@ -58,7 +58,7 @@ AdminTemplateController.prototype.register = function (templateRouter) {
|
||||
`/`,
|
||||
credentials(),
|
||||
authorizedByAPIKey({ authBackend: this.authBackend, action: 'list', label: 'GET TEMPLATE LIST' }),
|
||||
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_LIST),
|
||||
rateLimit(this.userLimitsBackend, RATE_LIMIT_ENDPOINTS_GROUPS.NAMED_LIST),
|
||||
listTemplates({ templateMaps: this.templateMaps })
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user