Improve naming

This commit is contained in:
Daniel García Aubert 2019-07-26 20:20:26 +02:00
parent 298297f2c5
commit db6002c267

View File

@ -1,17 +1,14 @@
'use strict'; 'use strict';
const PSQL = require('cartodb-psql'); const bodyParser = require('../middlewares/body-parser');
const bodyParserMiddleware = require('../middlewares/body-parser'); const { initializeProfilerMiddleware: initializeProfiler } = require('../middlewares/profiler');
const userMiddleware = require('../middlewares/user'); const user = require('../middlewares/user');
const errorMiddleware = require('../middlewares/error'); const rateLimits = require('../middlewares/rate-limit');
const authorizationMiddleware = require('../middlewares/authorization'); const authorization = require('../middlewares/authorization');
const connectionParamsMiddleware = require('../middlewares/connection-params'); const connectionParams = require('../middlewares/connection-params');
const timeoutLimitsMiddleware = require('../middlewares/timeout-limits'); const timeoutLimits = require('../middlewares/timeout-limits');
const { initializeProfilerMiddleware } = require('../middlewares/profiler');
const rateLimitsMiddleware = require('../middlewares/rate-limit');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimitsMiddleware;
const parameters = require('../middlewares/parameters'); const parameters = require('../middlewares/parameters');
const logMiddleware = require('../middlewares/log'); const log = require('../middlewares/log');
const cancelOnClientAbort = require('../middlewares/cancel-on-client-abort'); const cancelOnClientAbort = require('../middlewares/cancel-on-client-abort');
const affectedTables = require('../middlewares/affected-tables'); const affectedTables = require('../middlewares/affected-tables');
const accessValidator = require('../middlewares/access-validator'); const accessValidator = require('../middlewares/access-validator');
@ -22,6 +19,10 @@ const surrogateKey = require('../middlewares/surrogate-key');
const lastModified = require('../middlewares/last-modified'); const lastModified = require('../middlewares/last-modified');
const formatter = require('../middlewares/formatter'); const formatter = require('../middlewares/formatter');
const content = require('../middlewares/content'); const content = require('../middlewares/content');
const error = require('../middlewares/error');
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimits;
const PSQL = require('cartodb-psql');
module.exports = class QueryController { module.exports = class QueryController {
constructor (metadataBackend, userDatabaseService, statsdClient, userLimitsService) { constructor (metadataBackend, userDatabaseService, statsdClient, userLimitsService) {
@ -37,15 +38,15 @@ module.exports = class QueryController {
const queryMiddlewares = () => { const queryMiddlewares = () => {
return [ return [
bodyParserMiddleware(), bodyParser(),
initializeProfilerMiddleware('query'), initializeProfiler('query'),
userMiddleware(this.metadataBackend), user(this.metadataBackend),
rateLimitsMiddleware(this.userLimitsService, RATE_LIMIT_ENDPOINTS_GROUPS.QUERY), rateLimits(this.userLimitsService, RATE_LIMIT_ENDPOINTS_GROUPS.QUERY),
authorizationMiddleware(this.metadataBackend, forceToBeMaster), authorization(this.metadataBackend, forceToBeMaster),
connectionParamsMiddleware(this.userDatabaseService), connectionParams(this.userDatabaseService),
timeoutLimitsMiddleware(this.metadataBackend), timeoutLimits(this.metadataBackend),
parameters({ strategy: 'query' }), parameters({ strategy: 'query' }),
logMiddleware(logMiddleware.TYPES.QUERY), log(log.TYPES.QUERY),
cancelOnClientAbort(), cancelOnClientAbort(),
affectedTables(), affectedTables(),
accessValidator(), accessValidator(),
@ -57,7 +58,7 @@ module.exports = class QueryController {
formatter(), formatter(),
content(), content(),
handleQuery({ stats: this.stats }), handleQuery({ stats: this.stats }),
errorMiddleware() error()
]; ];
}; };