1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00
unleash.unleash/src/lib/routes/admin-api/index.ts
olav adface17c7
refactor: add OpenAPI schema to environments controller (#1682)
* refactor: normalize controller file names

* refactor: throw invalid responses in dev mode

* refactor: add OpenAPI schema to environments controller

* refactor: improve JSON schema prop removal code

* refactor: fix empty response specs
2022-06-10 10:04:56 +02:00

115 lines
3.9 KiB
TypeScript

import apiDef from './api-def.json';
import Controller from '../controller';
import { IUnleashServices } from '../../types/services';
import { IUnleashConfig } from '../../types/option';
import FeatureController from './feature';
import { FeatureTypeController } from './feature-type';
import ArchiveController from './archive';
import StrategyController from './strategy';
import EventController from './event';
import MetricsController from './metrics';
import UserController from './user';
import ConfigController from './config';
import ContextController from './context';
import ClientMetricsController from './client-metrics';
import BootstrapController from './bootstrap';
import StateController from './state';
import TagController from './tag';
import TagTypeController from './tag-type';
import AddonController from './addon';
import ApiTokenController from './api-token';
import UserAdminController from './user-admin';
import EmailController from './email';
import UserFeedbackController from './user-feedback';
import UserSplashController from './user-splash';
import ProjectApi from './project';
import { EnvironmentsController } from './environments';
import ConstraintsController from './constraints';
class AdminApi extends Controller {
constructor(config: IUnleashConfig, services: IUnleashServices) {
super(config);
this.app.get('/', this.index);
this.app.use(
'/features',
new FeatureController(config, services).router,
);
this.app.use(
'/feature-types',
new FeatureTypeController(config, services).router,
);
this.app.use(
'/archive',
new ArchiveController(config, services).router,
);
this.app.use(
'/strategies',
new StrategyController(config, services).router,
);
this.app.use('/events', new EventController(config, services).router);
this.app.use(
'/metrics',
new MetricsController(config, services).router,
);
this.app.use(
'/client-metrics',
new ClientMetricsController(config, services).router,
);
this.app.use('/user', new UserController(config, services).router);
this.app.use(
'/ui-config',
new ConfigController(config, services).router,
);
this.app.use(
'/ui-bootstrap',
new BootstrapController(config, services).router,
);
this.app.use(
'/context',
new ContextController(config, services).router,
);
this.app.use('/state', new StateController(config, services).router);
this.app.use('/tags', new TagController(config, services).router);
this.app.use(
'/tag-types',
new TagTypeController(config, services).router,
);
this.app.use('/addons', new AddonController(config, services).router);
this.app.use(
'/api-tokens',
new ApiTokenController(config, services).router,
);
this.app.use('/email', new EmailController(config, services).router);
this.app.use(
'/user-admin',
new UserAdminController(config, services).router,
);
this.app.use(
'/feedback',
new UserFeedbackController(config, services).router,
);
this.app.use('/projects', new ProjectApi(config, services).router);
this.app.use(
'/environments',
new EnvironmentsController(config, services).router,
);
this.app.use(
'/splash',
new UserSplashController(config, services).router,
);
this.app.use(
'/constraints',
new ConstraintsController(config, services).router,
);
}
index(req, res) {
res.json(apiDef);
}
}
module.exports = AdminApi;