UNPKG

unleash-server

Version:

Unleash is an enterprise ready feature flag service. It provides different strategies for handling feature flags.

38 lines 1.9 kB
import Controller from '../../routes/controller.js'; import { NONE, serializeDates, } from '../../types/index.js'; import { createResponseSchema, projectInsightsSchema, } from '../../openapi/index.js'; import { getStandardResponses } from '../../openapi/util/standard-responses.js'; export default class ProjectInsightsController extends Controller { constructor(config, services) { super(config); this.projectInsightsService = services.projectInsightsService; this.openApiService = services.openApiService; this.flagResolver = config.flagResolver; // TODO: Remove in v8. This endpoint is deprecated and no longer used by the UI. this.route({ method: 'get', path: '/:projectId/insights', handler: this.getProjectInsights, permission: NONE, middleware: [ this.openApiService.validPath({ deprecated: true, tags: ['Projects'], operationId: 'getProjectInsights', summary: 'Get an overview of a project insights.', description: 'This endpoint returns insights into the specified projects stats, health, lead time for changes, feature types used, members and change requests.', responses: { 200: createResponseSchema('projectInsightsSchema'), ...getStandardResponses(401, 403, 404), }, }), ], }); } async getProjectInsights(req, res) { const { projectId } = req.params; const insights = await this.projectInsightsService.getProjectInsights(projectId); this.openApiService.respondWithValidation(200, res, projectInsightsSchema.$id, serializeDates(insights)); } } //# sourceMappingURL=project-insights-controller.js.map