fixes: loosen up front validation, add resolveEntityRelationUniversalIdentifiers to update and restore (#18015)

closes https://github.com/twentyhq/private-issues/issues/419
This commit is contained in:
nitin
2026-02-18 16:05:08 +05:30
committed by GitHub
parent 08a3d983cb
commit 477fbc0865
14 changed files with 97 additions and 364 deletions
@@ -459,10 +459,7 @@ export class PageLayoutUpdateService {
pageLayoutTabId: widgetInput.pageLayoutTabId,
objectMetadataId: widgetInput.objectMetadataId,
},
flatEntityMaps: {
flatPageLayoutTabMaps,
flatObjectMetadataMaps,
},
flatEntityMaps: { flatPageLayoutTabMaps, flatObjectMetadataMaps },
});
return {
@@ -505,12 +502,26 @@ export class PageLayoutUpdateService {
const updatedConfiguration = widgetInput.configuration ?? null;
const {
pageLayoutTabUniversalIdentifier,
objectMetadataUniversalIdentifier,
} = resolveEntityRelationUniversalIdentifiers({
metadataName: 'pageLayoutWidget',
foreignKeyValues: {
pageLayoutTabId: widgetInput.pageLayoutTabId,
objectMetadataId: widgetInput.objectMetadataId,
},
flatEntityMaps: { flatPageLayoutTabMaps, flatObjectMetadataMaps },
});
return {
...existingWidget,
pageLayoutTabId: widgetInput.pageLayoutTabId,
pageLayoutTabUniversalIdentifier,
title: widgetInput.title,
type: widgetInput.type,
objectMetadataId: widgetInput.objectMetadataId ?? null,
objectMetadataUniversalIdentifier,
gridPosition: widgetInput.gridPosition,
position: widgetInput.position ?? null,
configuration: updatedConfiguration,
@@ -536,12 +547,26 @@ export class PageLayoutUpdateService {
const restoredConfiguration = widgetInput.configuration ?? null;
const {
pageLayoutTabUniversalIdentifier,
objectMetadataUniversalIdentifier,
} = resolveEntityRelationUniversalIdentifiers({
metadataName: 'pageLayoutWidget',
foreignKeyValues: {
pageLayoutTabId: widgetInput.pageLayoutTabId,
objectMetadataId: widgetInput.objectMetadataId,
},
flatEntityMaps: { flatPageLayoutTabMaps, flatObjectMetadataMaps },
});
return {
...existingWidget,
pageLayoutTabId: widgetInput.pageLayoutTabId,
pageLayoutTabUniversalIdentifier,
title: widgetInput.title,
type: widgetInput.type,
objectMetadataId: widgetInput.objectMetadataId ?? null,
objectMetadataUniversalIdentifier,
gridPosition: widgetInput.gridPosition,
position: widgetInput.position ?? null,
configuration: restoredConfiguration,