Use named params for controllers
This commit is contained in:
parent
c4db741028
commit
dc6e28097f
@ -19,7 +19,7 @@ const params = require('../middlewares/params');
|
||||
const tag = require('../middlewares/tag');
|
||||
|
||||
module.exports = class CopyController {
|
||||
constructor (metadataBackend, userDatabaseService, statsdClient, userLimitsService, logger) {
|
||||
constructor ({ metadataBackend, userDatabaseService, statsdClient, userLimitsService, logger }) {
|
||||
this.metadataBackend = metadataBackend;
|
||||
this.userDatabaseService = userDatabaseService;
|
||||
this.statsdClient = statsdClient;
|
||||
|
@ -14,7 +14,7 @@ const params = require('../middlewares/params');
|
||||
const tag = require('../middlewares/tag');
|
||||
|
||||
module.exports = class JobController {
|
||||
constructor (metadataBackend, userDatabaseService, jobService, statsdClient, userLimitsService, logger) {
|
||||
constructor ({ metadataBackend, userDatabaseService, jobService, statsdClient, userLimitsService, logger }) {
|
||||
this.metadataBackend = metadataBackend;
|
||||
this.userDatabaseService = userDatabaseService;
|
||||
this.jobService = jobService;
|
||||
|
@ -26,9 +26,9 @@ const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimits;
|
||||
const PSQL = require('cartodb-psql');
|
||||
|
||||
module.exports = class QueryController {
|
||||
constructor (metadataBackend, userDatabaseService, statsdClient, userLimitsService, logger) {
|
||||
constructor ({ metadataBackend, userDatabaseService, statsdClient, userLimitsService, logger }) {
|
||||
this.metadataBackend = metadataBackend;
|
||||
this.stats = statsdClient;
|
||||
this.statsdClient = statsdClient;
|
||||
this.userDatabaseService = userDatabaseService;
|
||||
this.userLimitsService = userLimitsService;
|
||||
this.logger = logger;
|
||||
@ -40,7 +40,7 @@ module.exports = class QueryController {
|
||||
const queryMiddlewares = () => {
|
||||
return [
|
||||
initLogger({ logger: this.logger }),
|
||||
profiler({ statsClient: this.stats }),
|
||||
profiler({ statsClient: this.statsdClient }),
|
||||
tag({ tags: ['query'] }),
|
||||
bodyParser(),
|
||||
user(this.metadataBackend),
|
||||
@ -60,7 +60,7 @@ module.exports = class QueryController {
|
||||
lastModified(),
|
||||
formatter(),
|
||||
content(),
|
||||
handleQuery({ stats: this.stats })
|
||||
handleQuery({ stats: this.statsdClient })
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -24,30 +24,30 @@ module.exports = class SqlRouter {
|
||||
const userDatabaseService = new UserDatabaseService(metadataBackend);
|
||||
const userLimitsService = new UserLimitsService(metadataBackend, userLimitsServiceOptions);
|
||||
|
||||
this.queryController = new QueryController(
|
||||
this.queryController = new QueryController({
|
||||
metadataBackend,
|
||||
userDatabaseService,
|
||||
statsClient,
|
||||
userLimitsService,
|
||||
logger
|
||||
);
|
||||
});
|
||||
|
||||
this.copyController = new CopyController(
|
||||
this.copyController = new CopyController({
|
||||
metadataBackend,
|
||||
userDatabaseService,
|
||||
statsClient,
|
||||
userLimitsService,
|
||||
logger
|
||||
);
|
||||
});
|
||||
|
||||
this.jobController = new JobController(
|
||||
this.jobController = new JobController({
|
||||
metadataBackend,
|
||||
userDatabaseService,
|
||||
jobService,
|
||||
statsClient,
|
||||
userLimitsService,
|
||||
logger
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
route (apiRouter, routes) {
|
||||
|
Loading…
Reference in New Issue
Block a user