add workspaceId to indirect entities (#19522)

Required for `workspace:export` command

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
neo773
2026-04-10 01:00:28 +05:30
committed by GitHub
parent 7ef80dd238
commit 8a10071253
38 changed files with 439 additions and 15 deletions
@@ -186,6 +186,7 @@ describe('ApplicationVariableEntityService', () => {
description: 'A secret key',
isSecret: true,
applicationId: mockApplicationId,
workspaceId: mockWorkspaceId,
},
]);
});
@@ -216,6 +217,7 @@ describe('ApplicationVariableEntityService', () => {
description: 'Public URL',
isSecret: false,
applicationId: mockApplicationId,
workspaceId: mockWorkspaceId,
},
]);
});
@@ -5,6 +5,7 @@ import {
Column,
CreateDateColumn,
Entity,
Index,
JoinColumn,
ManyToOne,
PrimaryGeneratedColumn,
@@ -14,6 +15,7 @@ import {
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
import { ApplicationEntity } from 'src/engine/core-modules/application/application.entity';
import type { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
import { EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface';
@Entity({
@@ -30,6 +32,14 @@ export class ApplicationVariableEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ nullable: false, type: 'uuid' })
@Index()
workspaceId: string;
@ManyToOne('WorkspaceEntity', { onDelete: 'CASCADE' })
@JoinColumn({ name: 'workspaceId' })
workspace: EntityRelation<WorkspaceEntity>;
@Column({ nullable: false, type: 'text' })
key: string;
@@ -136,6 +136,7 @@ export class ApplicationVariableEntityService {
description: description ?? '',
isSecret: isSecretValue,
applicationId,
workspaceId,
});
}
}
@@ -10,6 +10,7 @@ export const fromApplicationVariableEntityToFlatApplicationVariable = (
description: entity.description,
isSecret: entity.isSecret,
applicationId: entity.applicationId,
workspaceId: entity.workspaceId,
createdAt: entity.createdAt.toISOString(),
updatedAt: entity.updatedAt.toISOString(),
});