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:
Weiko
2025-10-17 19:23:00 +02:00
committed by GitHub
parent 84e7fabaab
commit cceeb6ed4d
79 changed files with 734 additions and 271 deletions
@@ -43,7 +43,7 @@ export const getFlatFieldMetadataMock = <T extends FieldMetadataType>(
standardId: null,
standardOverrides: null,
workspaceId: faker.string.uuid(),
applicationId: faker.string.uuid(),
relationTargetFieldMetadataId: null,
relationTargetObjectMetadataId: null,
...overrides,
@@ -62,5 +62,6 @@ export const getRelationTargetFlatFieldMetadataMock = ({
...overrides,
defaultValue: null,
options: null,
applicationId: faker.string.uuid(),
};
};
@@ -104,6 +104,7 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
"result": {
"flatFieldMetadatas": [
{
"applicationId": null,
"createdAt": Any<ClockDate>,
"defaultValue": null,
"description": "new field description",
@@ -137,6 +138,7 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
"workspaceId": Any<String>,
},
{
"applicationId": null,
"createdAt": Any<ClockDate>,
"defaultValue": null,
"description": null,
@@ -172,6 +174,7 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
"workspaceId": Any<String>,
},
{
"applicationId": null,
"createdAt": Any<ClockDate>,
"defaultValue": null,
"description": "new field description",
@@ -205,6 +208,7 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
"workspaceId": Any<String>,
},
{
"applicationId": null,
"createdAt": Any<ClockDate>,
"defaultValue": null,
"description": null,
@@ -242,6 +246,7 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
],
"indexMetadatas": [
{
"applicationId": null,
"createdAt": Any<ClockDate>,
"flatIndexFieldMetadatas": [
{
@@ -265,6 +270,7 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
"workspaceId": Any<String>,
},
{
"applicationId": null,
"createdAt": Any<ClockDate>,
"flatIndexFieldMetadatas": [
{
@@ -9,6 +9,7 @@ export const FIELD_METADATA_RELATION_PROPERTIES = [
'indexFieldMetadatas',
'object',
'viewFields',
'application',
'viewFilters',
'viewGroups',
] as const satisfies (keyof FieldMetadataEntity)[];
@@ -44,6 +44,7 @@ export const generateIndexForFlatFieldMetadata = ({
universalIdentifier: indexId,
updatedAt: createdAt,
workspaceId,
applicationId: null,
},
flatObjectMetadata,
},
@@ -54,6 +54,7 @@ export const getDefaultFlatFieldMetadata = ({
updatedAt: createdAt,
isUIReadOnly: createFieldInput.isUIReadOnly ?? false,
morphId: null,
applicationId: null,
viewFilterIds: [],
viewGroupIds: [],
} as const satisfies FlatFieldMetadata;
@@ -71,6 +71,7 @@ export const recomputeViewGroupsOnEnumFlatFieldMetadataIsNullableUpdate = ({
updatedAt: createdAt,
deletedAt: null,
viewId,
applicationId: toFlatFieldMetadata.applicationId,
});
} else if (isDefined(emptyValueFlatViewGroup)) {
sideEffectResult.flatViewGroupsToDelete.push(emptyValueFlatViewGroup);
@@ -109,6 +109,7 @@ export const recomputeViewGroupsOnFlatFieldMetadataOptionsUpdate = ({
isVisible: true,
fieldValue: option.value,
position: viewGroupHighestPosition + createdOptionIndex + 1,
applicationId: fromFlatFieldMetadata.applicationId,
};
}),
);