UNPKG

unleash-server

Version:

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

43 lines 1.82 kB
import Controller from '../controller.js'; import { NONE } from '../../types/permissions.js'; import { createResponseSchema } from '../../openapi/util/create-response-schema.js'; import { splashRequestSchema } from '../../openapi/spec/splash-request-schema.js'; import { getStandardResponses } from '../../openapi/index.js'; class UserSplashController extends Controller { constructor(config, { userSplashService, openApiService, }) { super(config); this.userSplashService = userSplashService; this.openApiService = openApiService; this.route({ method: 'post', path: '/:id', acceptAnyContentType: true, handler: this.updateSplashSettings, permission: NONE, middleware: [ openApiService.validPath({ tags: ['Admin UI'], operationId: 'updateSplashSettings', summary: 'Update splash settings', description: 'This operation updates splash settings for a user, indicating that they have seen a particualar splash screen.', responses: { 200: createResponseSchema('splashResponseSchema'), ...getStandardResponses(400, 401, 403, 415), }, }), ], }); } async updateSplashSettings(req, res) { const { user } = req; const { id } = req.params; const splash = { splashId: id, userId: user.id, seen: true, }; this.openApiService.respondWithValidation(200, res, splashRequestSchema.$id, await this.userSplashService.updateSplash(splash)); } } export default UserSplashController; //# sourceMappingURL=user-splash.js.map