mirror of
https://github.com/Unleash/unleash.git
synced 2026-01-05 20:06:22 +01:00
feat: export project specific context fields
This commit is contained in:
parent
81d898c067
commit
7a25d724be
@ -340,7 +340,10 @@ export class ContextController extends Controller {
|
||||
const result = await this.transactionalContextService.transactional(
|
||||
(service) =>
|
||||
service.createContextField(
|
||||
{ ...value, project: req.params.projectId },
|
||||
{
|
||||
...value,
|
||||
project: req.params.projectId || value.project,
|
||||
},
|
||||
req.audit,
|
||||
),
|
||||
);
|
||||
|
||||
@ -170,6 +170,7 @@ beforeAll(async () => {
|
||||
experimental: {
|
||||
flags: {
|
||||
featureLinks: true,
|
||||
projectContextFields: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -201,8 +202,8 @@ afterAll(async () => {
|
||||
await db.destroy();
|
||||
});
|
||||
|
||||
describe('import-export for project-specific segments', () => {
|
||||
test('exports features with project-specific-segments', async () => {
|
||||
describe('import-export for project specific segments', () => {
|
||||
test('exports features with project specific segments and context fields', async () => {
|
||||
const segmentName = 'my-segment';
|
||||
const project = 'with-segments';
|
||||
await createProjects([project]);
|
||||
@ -211,6 +212,10 @@ describe('import-export for project-specific segments', () => {
|
||||
project,
|
||||
constraints: [],
|
||||
});
|
||||
await app.createContextField({
|
||||
name: 'projectAppName',
|
||||
project,
|
||||
});
|
||||
const strategy = {
|
||||
name: 'default',
|
||||
parameters: {
|
||||
@ -219,7 +224,7 @@ describe('import-export for project-specific segments', () => {
|
||||
},
|
||||
constraints: [
|
||||
{
|
||||
contextName: 'appName',
|
||||
contextName: 'projectAppName',
|
||||
values: ['test'],
|
||||
operator: 'IN' as const,
|
||||
},
|
||||
@ -265,6 +270,7 @@ describe('import-export for project-specific segments', () => {
|
||||
name: segmentName,
|
||||
},
|
||||
],
|
||||
contextFields: [{ name: 'projectAppName', project }],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -63,6 +63,13 @@ export const contextFieldSchema = {
|
||||
$ref: '#/components/schemas/legalValueSchema',
|
||||
},
|
||||
},
|
||||
project: {
|
||||
description:
|
||||
'The project this context field belongs to (if it is project-specific)',
|
||||
type: 'string',
|
||||
nullable: true,
|
||||
example: 'my-project',
|
||||
},
|
||||
},
|
||||
components: {
|
||||
schemas: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user