1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

chore: openapai favorite endpoints (#4189)

<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
Adds description and summary to `favorite` endpoints
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #
[1-1098](https://linear.app/unleash/issue/1-1098/openapi-features-favorites)

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
This commit is contained in:
andreas-unleash 2023-07-10 14:13:00 +03:00 committed by GitHub
parent 5b95eed163
commit d5ef1dda0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 6 deletions

View File

@ -3,7 +3,7 @@ import Controller from '../controller';
import { FavoritesService, OpenApiService } from '../../services';
import { Logger } from '../../logger';
import { IUnleashConfig, IUnleashServices, NONE } from '../../types';
import { emptyResponse } from '../../openapi';
import { emptyResponse, getStandardResponses } from '../../openapi';
import { IAuthRequest } from '../unleash-types';
export default class FavoritesController extends Controller {
@ -34,7 +34,13 @@ export default class FavoritesController extends Controller {
openApiService.validPath({
tags: ['Features'],
operationId: 'addFavoriteFeature',
responses: { 200: emptyResponse },
summary: 'Add feature to favorites',
description:
'This endpoint marks the feature in the url as favorite',
responses: {
200: emptyResponse,
...getStandardResponses(401, 404),
},
}),
],
});
@ -48,7 +54,13 @@ export default class FavoritesController extends Controller {
openApiService.validPath({
tags: ['Features'],
operationId: 'removeFavoriteFeature',
responses: { 200: emptyResponse },
summary: 'Remove feature from favorites',
description:
'This endpoint removes the feature in the url from favorites',
responses: {
200: emptyResponse,
...getStandardResponses(401, 404),
},
}),
],
});
@ -61,8 +73,14 @@ export default class FavoritesController extends Controller {
middleware: [
openApiService.validPath({
tags: ['Features'],
summary: 'Add project to favorites',
description:
'This endpoint marks the project in the url as favorite',
operationId: 'addFavoriteProject',
responses: { 200: emptyResponse },
responses: {
200: emptyResponse,
...getStandardResponses(401, 404),
},
}),
],
});
@ -75,8 +93,14 @@ export default class FavoritesController extends Controller {
middleware: [
openApiService.validPath({
tags: ['Features'],
summary: 'Remove project from favorites',
description:
'This endpoint removes the project in the url from favorites',
operationId: 'removeFavoriteProject',
responses: { 200: emptyResponse },
responses: {
200: emptyResponse,
...getStandardResponses(401, 404),
},
}),
],
});

View File

@ -81,7 +81,13 @@ const getProjects = async () => {
beforeAll(async () => {
db = await dbInit('favorites_api_serial', getLogger);
app = await setupAppWithAuth(db.stores);
app = await setupAppWithAuth(db.stores, {
experimental: {
flags: {
strictSchemaValidation: true,
},
},
});
stores = db.stores;
accessService = app.services.accessService;