2017-06-28 10:20:22 +02:00
|
|
|
'use strict';
|
|
|
|
|
2018-11-30 10:11:36 +01:00
|
|
|
const Controller = require('../controller');
|
2018-11-30 11:11:12 +01:00
|
|
|
const FeatureController = require('./feature.js');
|
2018-11-30 08:24:22 +01:00
|
|
|
const ArchiveController = require('./archive.js');
|
2018-11-30 10:11:36 +01:00
|
|
|
const EventController = require('./event.js');
|
2018-12-05 21:07:45 +01:00
|
|
|
const StrategyController = require('./strategy');
|
2018-12-04 08:50:45 +01:00
|
|
|
const MetricsController = require('./metrics');
|
2018-12-04 08:16:03 +01:00
|
|
|
const UserController = require('./user');
|
2018-11-29 21:25:45 +01:00
|
|
|
const apiDef = require('./api-def.json');
|
|
|
|
|
2018-11-30 10:11:36 +01:00
|
|
|
class AdminApi extends Controller {
|
2018-11-29 21:25:45 +01:00
|
|
|
constructor(config) {
|
2018-11-30 10:11:36 +01:00
|
|
|
super();
|
|
|
|
|
|
|
|
const stores = config.stores;
|
2018-12-19 10:36:56 +01:00
|
|
|
const perms = config.extendedPermissions;
|
2018-11-29 21:25:45 +01:00
|
|
|
|
2018-11-30 10:11:36 +01:00
|
|
|
this.app.get('/', this.index);
|
2018-12-19 10:36:56 +01:00
|
|
|
this.app.use('/features', new FeatureController(perms, stores).router);
|
|
|
|
this.app.use('/archive', new ArchiveController(perms, stores).router);
|
|
|
|
this.app.use(
|
|
|
|
'/strategies',
|
|
|
|
new StrategyController(perms, stores).router
|
|
|
|
);
|
2018-12-03 08:59:13 +01:00
|
|
|
this.app.use('/events', new EventController(stores).router);
|
2018-12-19 10:36:56 +01:00
|
|
|
this.app.use('/metrics', new MetricsController(perms, stores).router);
|
2018-12-19 13:35:54 +01:00
|
|
|
this.app.use('/user', new UserController(perms).router);
|
2018-11-29 21:25:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
index(req, res) {
|
|
|
|
res.json(apiDef);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = AdminApi;
|