Add applicationId to syncableEntity and fix syncApp deletion (#15170)
## Context - All flatEntity should extend SyncableEntity - SyncableEntity should now have applicationId and application relation - Fix syncApp deletion, should now properly use migration v2 to delete syncable entities
This commit is contained in:
+8
@@ -127,6 +127,14 @@ export class WorkspaceMigrationBuildOrchestratorService {
|
||||
...flatFieldMetadataMaps?.from.idByUniversalIdentifier,
|
||||
...flatFieldMetadataMaps?.to.idByUniversalIdentifier,
|
||||
},
|
||||
universalIdentifiersByApplicationId: {
|
||||
...dependencyAllFlatEntityMaps?.flatFieldMetadataMaps
|
||||
?.universalIdentifiersByApplicationId,
|
||||
...flatFieldMetadataMaps?.from
|
||||
.universalIdentifiersByApplicationId,
|
||||
...flatFieldMetadataMaps?.to
|
||||
.universalIdentifiersByApplicationId,
|
||||
},
|
||||
},
|
||||
},
|
||||
///
|
||||
|
||||
+2
@@ -8,6 +8,8 @@ export type PartialIndexMetadata = Omit<
|
||||
| 'createdAt'
|
||||
| 'updatedAt'
|
||||
| 'universalIdentifier'
|
||||
| 'application'
|
||||
| 'applicationId'
|
||||
> & {
|
||||
columns: string[];
|
||||
};
|
||||
|
||||
+1
@@ -15,4 +15,5 @@ export const ADMIN_ROLE: StandardRoleDefinition = {
|
||||
canBeAssignedToUsers: true,
|
||||
canBeAssignedToAgents: false,
|
||||
canBeAssignedToApiKeys: true,
|
||||
applicationId: null, // TODO: Replace with Twenty application ID
|
||||
};
|
||||
|
||||
+1
@@ -15,4 +15,5 @@ export const DATA_MANIPULATOR_ROLE: StandardRoleDefinition = {
|
||||
canBeAssignedToUsers: false,
|
||||
canBeAssignedToAgents: true,
|
||||
canBeAssignedToApiKeys: false,
|
||||
applicationId: null, // TODO: Replace with Twenty application ID
|
||||
};
|
||||
|
||||
+1
@@ -15,4 +15,5 @@ export const DATA_NAVIGATOR_ROLE: StandardRoleDefinition = {
|
||||
canBeAssignedToUsers: false,
|
||||
canBeAssignedToAgents: true,
|
||||
canBeAssignedToApiKeys: false,
|
||||
applicationId: null, // TODO: Replace with Twenty application ID
|
||||
};
|
||||
|
||||
+1
@@ -17,4 +17,5 @@ export const WORKFLOW_MANAGER_ROLE: StandardRoleDefinition = {
|
||||
canBeAssignedToAgents: true,
|
||||
canBeAssignedToApiKeys: false,
|
||||
permissionFlags: [PermissionFlagType.WORKFLOWS],
|
||||
applicationId: null, // TODO: Replace with Twenty application ID
|
||||
};
|
||||
|
||||
+13
-1
@@ -1,4 +1,6 @@
|
||||
import { Column, Index } from 'typeorm';
|
||||
import { Column, Index, JoinColumn, ManyToOne, Relation } from 'typeorm';
|
||||
|
||||
import type { ApplicationEntity } from 'src/engine/core-modules/application/application.entity';
|
||||
|
||||
@Index(['workspaceId', 'universalIdentifier'], {
|
||||
unique: true,
|
||||
@@ -6,4 +8,14 @@ import { Column, Index } from 'typeorm';
|
||||
export abstract class SyncableEntity {
|
||||
@Column({ nullable: true, type: 'uuid' })
|
||||
universalIdentifier: string | null;
|
||||
|
||||
@Column({ nullable: true, type: 'uuid' })
|
||||
applicationId: string | null;
|
||||
|
||||
@ManyToOne('ApplicationEntity', {
|
||||
onDelete: 'CASCADE',
|
||||
nullable: true,
|
||||
})
|
||||
@JoinColumn({ name: 'applicationId' })
|
||||
application: Relation<ApplicationEntity>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user