unleash-server
Version:
Unleash is an enterprise ready feature flag service. It provides different strategies for handling feature flags.
36 lines • 1.71 kB
JavaScript
import Controller from '../../routes/controller.js';
import { NONE, serializeDates, } from '../../types/index.js';
import { getStandardResponses } from '../../openapi/util/standard-responses.js';
import { createResponseSchema, projectStatusSchema, } from '../../openapi/index.js';
export default class ProjectStatusController extends Controller {
constructor(config, services) {
super(config);
this.projectStatusService = services.projectStatusService;
this.openApiService = services.openApiService;
this.flagResolver = config.flagResolver;
this.route({
method: 'get',
path: '/:projectId/status',
handler: this.getProjectStatus,
permission: NONE,
middleware: [
this.openApiService.validPath({
tags: ['Unstable'],
operationId: 'getProjectStatus',
summary: 'Get project status',
description: 'This endpoint returns information on the status the project, including activities, health, resources, and aggregated flag lifecycle data.',
responses: {
200: createResponseSchema('projectStatusSchema'),
...getStandardResponses(401, 403, 404),
},
}),
],
});
}
async getProjectStatus(req, res) {
const { projectId } = req.params;
const status = await this.projectStatusService.getProjectStatus(projectId);
this.openApiService.respondWithValidation(200, res, projectStatusSchema.$id, serializeDates(status));
}
}
//# sourceMappingURL=project-status-controller.js.map