mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-01 01:18:10 +02:00
Make single project endpoint also return all features favorites (#2578)
Small update, that single project endpoint would also return features with favorites.
This commit is contained in:
parent
60c9718b8d
commit
24fee65f7e
src
lib
test/e2e/api/admin
@ -403,10 +403,8 @@ export default class ProjectFeaturesController extends Controller {
|
|||||||
res: Response<FeaturesSchema>,
|
res: Response<FeaturesSchema>,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const { projectId } = req.params;
|
const { projectId } = req.params;
|
||||||
const { user } = req;
|
|
||||||
const features = await this.featureService.getFeatureOverview({
|
const features = await this.featureService.getFeatureOverview({
|
||||||
projectId,
|
projectId,
|
||||||
userId: user.id,
|
|
||||||
});
|
});
|
||||||
this.openApiService.respondWithValidation(
|
this.openApiService.respondWithValidation(
|
||||||
200,
|
200,
|
||||||
|
@ -72,6 +72,7 @@ export default class ProjectHealthService {
|
|||||||
const features = await this.featureToggleService.getFeatureOverview({
|
const features = await this.featureToggleService.getFeatureOverview({
|
||||||
projectId,
|
projectId,
|
||||||
archived,
|
archived,
|
||||||
|
userId,
|
||||||
});
|
});
|
||||||
const members = await this.projectStore.getMembersCountByProject(
|
const members = await this.projectStore.getMembersCountByProject(
|
||||||
projectId,
|
projectId,
|
||||||
|
@ -111,16 +111,21 @@ test('should be favorited in project endpoint', async () => {
|
|||||||
const featureName = 'test-feature';
|
const featureName = 'test-feature';
|
||||||
await createFeature(featureName);
|
await createFeature(featureName);
|
||||||
await favoriteFeature(featureName);
|
await favoriteFeature(featureName);
|
||||||
|
await favoriteProject();
|
||||||
|
|
||||||
const { body } = await app.request
|
const { body } = await app.request
|
||||||
.get(`/api/admin/projects/default/features`)
|
.get(`/api/admin/projects/default`)
|
||||||
.set('Content-Type', 'application/json')
|
.set('Content-Type', 'application/json')
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(body.features).toHaveLength(1);
|
expect(body).toMatchObject({
|
||||||
expect(body.features[0]).toMatchObject({
|
|
||||||
name: featureName,
|
|
||||||
favorite: true,
|
favorite: true,
|
||||||
|
features: [
|
||||||
|
{
|
||||||
|
name: featureName,
|
||||||
|
favorite: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -129,12 +134,11 @@ test('feature should not be favorited by default', async () => {
|
|||||||
await createFeature(featureName);
|
await createFeature(featureName);
|
||||||
|
|
||||||
const { body } = await app.request
|
const { body } = await app.request
|
||||||
.get(`/api/admin/projects/default/features`)
|
.get(`/api/admin/projects/default/features/${featureName}`)
|
||||||
.set('Content-Type', 'application/json')
|
.set('Content-Type', 'application/json')
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(body.features).toHaveLength(1);
|
expect(body).toMatchObject({
|
||||||
expect(body.features[0]).toMatchObject({
|
|
||||||
name: featureName,
|
name: featureName,
|
||||||
favorite: false,
|
favorite: false,
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user