Use ES6 template string for route definition

This commit is contained in:
Daniel García Aubert 2017-11-19 14:05:20 +01:00
parent 967d9b76e6
commit e131df601c

View File

@ -10,7 +10,7 @@ module.exports = AnalysesController;
AnalysesController.prototype.register = function (app) { AnalysesController.prototype.register = function (app) {
app.get( app.get(
app.base_url_mapconfig + '/analyses/catalog', `${app.base_url_mapconfig}/analyses/catalog`,
cors(), cors(),
userMiddleware, userMiddleware,
this.prepareContext, this.prepareContext,
@ -56,9 +56,11 @@ AnalysesController.prototype.prepareResponse = function () {
const analysisIdToTable = tables.reduce((analysisIdToTable, table) => { const analysisIdToTable = tables.reduce((analysisIdToTable, table) => {
const analysisId = table.relname.split('_')[2]; const analysisId = table.relname.split('_')[2];
if (analysisId && analysisId.length === 40) { if (analysisId && analysisId.length === 40) {
analysisIdToTable[analysisId] = table; analysisIdToTable[analysisId] = table;
} }
return analysisIdToTable; return analysisIdToTable;
}, {}); }, {});
@ -66,6 +68,7 @@ AnalysesController.prototype.prepareResponse = function () {
if (analysisIdToTable.hasOwnProperty(analysis.node_id)) { if (analysisIdToTable.hasOwnProperty(analysis.node_id)) {
analysis.table = analysisIdToTable[analysis.node_id]; analysis.table = analysisIdToTable[analysis.node_id];
} }
return analysis; return analysis;
}) })
.sort((analysisA, analysisB) => { .sort((analysisA, analysisB) => {