unleash-server
Version:
Unleash is an enterprise ready feature flag service. It provides different strategies for handling feature flags.
39 lines • 2 kB
JavaScript
import Controller from '../../controller.js';
import { NONE } from '../../../types/permissions.js';
import { createResponseSchema } from '../../../openapi/util/create-response-schema.js';
import { getStandardResponses } from '../../../openapi/util/standard-responses.js';
import { serializeDates } from '../../../types/serialize-dates.js';
import { healthReportSchema, } from '../../../openapi/spec/health-report-schema.js';
export default class ProjectHealthReport extends Controller {
constructor(config, { projectHealthService, openApiService, }) {
super(config);
this.logger = config.getLogger('/admin-api/project/health-report');
this.projectHealthService = projectHealthService;
this.openApiService = openApiService;
this.route({
method: 'get',
path: '/:projectId/health-report',
handler: this.getProjectHealthReport,
permission: NONE,
middleware: [
openApiService.validPath({
tags: ['Projects'],
deprecated: true,
operationId: 'getProjectHealthReport',
summary: 'Get a health report for a project.',
description: 'This endpoint returns a health report for the specified project. This data is used for [the technical debt insights](https://docs.getunleash.io/concepts/technical-debt)',
responses: {
200: createResponseSchema('healthReportSchema'),
...getStandardResponses(401, 403, 404),
},
}),
],
});
}
async getProjectHealthReport(req, res) {
const { projectId } = req.params;
const overview = await this.projectHealthService.getProjectHealthReport(projectId);
this.openApiService.respondWithValidation(200, res, healthReportSchema.$id, serializeDates(overview));
}
}
//# sourceMappingURL=health-report.js.map