mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-13 13:48:59 +02:00
fix: project environments have info about required approvals (#9929)
This commit is contained in:
parent
c8ebaa49fc
commit
3865fb41ae
@ -56,3 +56,14 @@ test('querying environments in OSS only returns environments that are included i
|
||||
expect(names).toEqual(['default', 'development', 'production']);
|
||||
});
|
||||
});
|
||||
|
||||
test('querying project environments in OSS only returns environments that are included in oss', async () => {
|
||||
await app.request
|
||||
.get('/api/admin/environments/project/default')
|
||||
.expect(200)
|
||||
.expect((res) => {
|
||||
expect(res.body.environments).toHaveLength(3);
|
||||
const names = res.body.environments.map((env) => env.name);
|
||||
expect(names).toEqual(['default', 'development', 'production']);
|
||||
});
|
||||
});
|
||||
|
@ -231,15 +231,16 @@ export class EnvironmentsController extends Controller {
|
||||
req: Request<ProjectParam>,
|
||||
res: Response<EnvironmentsProjectSchema>,
|
||||
): Promise<void> {
|
||||
const environments = await this.service.getProjectEnvironments(
|
||||
req.params.projectId,
|
||||
);
|
||||
this.openApiService.respondWithValidation(
|
||||
200,
|
||||
res,
|
||||
environmentsProjectSchema.$id,
|
||||
{
|
||||
version: 1,
|
||||
environments: (await this.service.getProjectEnvironments(
|
||||
req.params.projectId,
|
||||
)) as any,
|
||||
environments,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
import type { FromSchema } from 'json-schema-to-ts';
|
||||
import { createFeatureStrategySchema } from './create-feature-strategy-schema';
|
||||
import { createStrategyVariantSchema } from './create-strategy-variant-schema';
|
||||
import { constraintSchema } from './constraint-schema';
|
||||
import { parametersSchema } from './parameters-schema';
|
||||
|
||||
export const environmentProjectSchema = {
|
||||
$id: '#/components/schemas/environmentProjectSchema',
|
||||
@ -63,11 +65,21 @@ export const environmentProjectSchema = {
|
||||
description:
|
||||
'Indicates whether the environment can be enabled for feature flags in the project',
|
||||
},
|
||||
requiredApprovals: {
|
||||
type: 'integer',
|
||||
nullable: true,
|
||||
description:
|
||||
'Experimental field. The number of approvals required before a change request can be applied in this environment.',
|
||||
minimum: 1,
|
||||
example: 3,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
schemas: {
|
||||
createFeatureStrategySchema,
|
||||
createStrategyVariantSchema,
|
||||
constraintSchema,
|
||||
parametersSchema,
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
@ -1,5 +1,9 @@
|
||||
import type { FromSchema } from 'json-schema-to-ts';
|
||||
import { environmentProjectSchema } from './environment-project-schema';
|
||||
import { createFeatureStrategySchema } from './create-feature-strategy-schema';
|
||||
import { createStrategyVariantSchema } from './create-strategy-variant-schema';
|
||||
import { constraintSchema } from './constraint-schema';
|
||||
import { parametersSchema } from './parameters-schema';
|
||||
|
||||
export const environmentsProjectSchema = {
|
||||
$id: '#/components/schemas/environmentsProjectSchema',
|
||||
@ -24,6 +28,10 @@ export const environmentsProjectSchema = {
|
||||
components: {
|
||||
schemas: {
|
||||
environmentProjectSchema,
|
||||
createFeatureStrategySchema,
|
||||
createStrategyVariantSchema,
|
||||
constraintSchema,
|
||||
parametersSchema,
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
Loading…
Reference in New Issue
Block a user