Improve infer deletion from entities (#15807)

## Context
inferDeletionFromEntities only accepts a set of keys for each entities
that needs deletion. This could be error-prone if tmr we want to add a
new side effect and forget to add the entity when in practice you want
to delete all entities that are in the fromToAllFlatEntityMaps (this is
the case for applications for example)
This commit is contained in:
Weiko
2025-11-13 18:18:27 +01:00
committed by GitHub
parent 56b3a0e8a5
commit 998365457e
7 changed files with 33 additions and 22 deletions
@@ -2,7 +2,6 @@ import { Injectable, Logger } from '@nestjs/common';
import { parse } from 'path';
import { ALL_METADATA_NAME, AllMetadataName } from 'twenty-shared/metadata';
import { isDefined } from 'twenty-shared/utils';
import { ApplicationEntity } from 'src/engine/core-modules/application/application.entity';
@@ -1012,15 +1011,7 @@ export class ApplicationSyncService {
workspaceId,
buildOptions: {
isSystemBuild: true,
inferDeletionFromMissingEntities: {
...Object.values(ALL_METADATA_NAME).reduce(
(acc, metadataName) => ({
...acc,
[metadataName]: true,
}),
{} as Partial<Record<AllMetadataName, boolean>>,
),
},
inferDeletionFromMissingEntities: true,
},
},
);