UNPKG

unleash-server

Version:

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

42 lines 1.74 kB
import { unknownFlagsResponseSchema, } from '../../../openapi/index.js'; import { createResponseSchema } from '../../../openapi/util/create-response-schema.js'; import Controller from '../../../routes/controller.js'; import { NONE } from '../../../types/permissions.js'; import { serializeDates } from '../../../types/serialize-dates.js'; export default class UnknownFlagsController extends Controller { constructor(config, { unknownFlagsService, openApiService, }) { super(config); this.unknownFlagsService = unknownFlagsService; this.openApiService = openApiService; this.route({ method: 'get', path: '', handler: this.getUnknownFlags, permission: NONE, middleware: [ openApiService.validPath({ operationId: 'getUnknownFlags', tags: ['Unknown Flags'], summary: 'Get unknown flags', description: 'Returns a list of unknown flag reports from the last 24 hours, if any. Maximum of 1000.', responses: { 200: createResponseSchema('unknownFlagsResponseSchema'), }, }), ], }); } async getUnknownFlags(_, res) { const unknownFlags = await this.unknownFlagsService.getAll({ limit: 1000, orderBy: [ { column: 'name', order: 'asc', }, ], }); this.openApiService.respondWithValidation(200, res, unknownFlagsResponseSchema.$id, serializeDates({ unknownFlags })); } } //# sourceMappingURL=unknown-flags-controller.js.map