Use ES6 class syntax in Copy from/to controller
This commit is contained in:
parent
6c775c1857
commit
d85331e97b
@ -17,14 +17,15 @@ const { PassThrough } = require('stream');
|
|||||||
const params = require('../middlewares/params');
|
const params = require('../middlewares/params');
|
||||||
const bodyParserMiddleware = require('../middlewares/body-parser');
|
const bodyParserMiddleware = require('../middlewares/body-parser');
|
||||||
|
|
||||||
function CopyController(metadataBackend, userDatabaseService, userLimitsService, logger) {
|
module.exports = class CopyController {
|
||||||
|
constructor (metadataBackend, userDatabaseService, userLimitsService, logger) {
|
||||||
this.metadataBackend = metadataBackend;
|
this.metadataBackend = metadataBackend;
|
||||||
this.userDatabaseService = userDatabaseService;
|
this.userDatabaseService = userDatabaseService;
|
||||||
this.userLimitsService = userLimitsService;
|
this.userLimitsService = userLimitsService;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyController.prototype.route = function (apiRouter) {
|
route (apiRouter) {
|
||||||
const copyFromMiddlewares = endpointGroup => {
|
const copyFromMiddlewares = endpointGroup => {
|
||||||
return [
|
return [
|
||||||
initializeProfilerMiddleware('copyfrom'),
|
initializeProfilerMiddleware('copyfrom'),
|
||||||
@ -58,6 +59,7 @@ CopyController.prototype.route = function (apiRouter) {
|
|||||||
apiRouter.post('/sql/copyfrom', copyFromMiddlewares(RATE_LIMIT_ENDPOINTS_GROUPS.COPY_FROM));
|
apiRouter.post('/sql/copyfrom', copyFromMiddlewares(RATE_LIMIT_ENDPOINTS_GROUPS.COPY_FROM));
|
||||||
apiRouter.get('/sql/copyto', copyToMiddlewares(RATE_LIMIT_ENDPOINTS_GROUPS.COPY_TO));
|
apiRouter.get('/sql/copyto', copyToMiddlewares(RATE_LIMIT_ENDPOINTS_GROUPS.COPY_TO));
|
||||||
apiRouter.post('/sql/copyto', copyToMiddlewares(RATE_LIMIT_ENDPOINTS_GROUPS.COPY_TO));
|
apiRouter.post('/sql/copyto', copyToMiddlewares(RATE_LIMIT_ENDPOINTS_GROUPS.COPY_TO));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleCopyTo (logger) {
|
function handleCopyTo (logger) {
|
||||||
@ -178,5 +180,3 @@ function errorHandler (logger) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = CopyController;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user