[FRONT COMPONENTS] Serialize relation between widget and front component (#18228)

This allows us to define page layout widgets of type front component in
an app with the front component universal identifier.
This commit is contained in:
Raphaël Bosi
2026-02-25 15:01:50 +01:00
committed by GitHub
parent 448241540d
commit 435e21d23f
15 changed files with 118 additions and 5 deletions
@@ -1,7 +1,10 @@
import { Field, ObjectType } from '@nestjs/graphql';
import { IsIn, IsNotEmpty, IsUUID } from 'class-validator';
import { type FrontComponentConfiguration } from 'twenty-shared/types';
import {
type FrontComponentConfiguration,
type SerializedRelation,
} from 'twenty-shared/types';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
import { WidgetConfigurationType } from 'src/engine/metadata-modules/page-layout-widget/enums/widget-configuration-type.type';
@@ -18,5 +21,5 @@ export class FrontComponentConfigurationDTO
@Field(() => UUIDScalarType)
@IsNotEmpty()
@IsUUID()
frontComponentId: string;
frontComponentId: SerializedRelation;
}
@@ -243,6 +243,7 @@ export class PageLayoutWidgetService {
flatPageLayoutTabMaps,
flatObjectMetadataMaps,
flatFieldMetadataMaps,
flatFrontComponentMaps,
flatViewFieldGroupMaps,
flatViewMaps,
} =
@@ -253,6 +254,7 @@ export class PageLayoutWidgetService {
'flatPageLayoutTabMaps',
'flatObjectMetadataMaps',
'flatFieldMetadataMaps',
'flatFrontComponentMaps',
'flatViewFieldGroupMaps',
'flatViewMaps',
],
@@ -267,6 +269,7 @@ export class PageLayoutWidgetService {
flatPageLayoutTabMaps,
flatObjectMetadataMaps,
flatFieldMetadataMaps,
flatFrontComponentMaps,
flatViewFieldGroupMaps,
flatViewMaps,
});
@@ -327,6 +330,7 @@ export class PageLayoutWidgetService {
const {
flatObjectMetadataMaps: existingFlatObjectMetadataMaps,
flatFieldMetadataMaps: existingFlatFieldMetadataMaps,
flatFrontComponentMaps: existingFlatFrontComponentMaps,
flatViewFieldGroupMaps: existingFlatViewFieldGroupMaps,
flatViewMaps: existingFlatViewMaps,
} = await this.workspaceManyOrAllFlatEntityMapsCacheService.getOrRecomputeManyOrAllFlatEntityMaps(
@@ -335,6 +339,7 @@ export class PageLayoutWidgetService {
flatMapsKeys: [
'flatObjectMetadataMaps',
'flatFieldMetadataMaps',
'flatFrontComponentMaps',
'flatViewFieldGroupMaps',
'flatViewMaps',
],
@@ -369,6 +374,7 @@ export class PageLayoutWidgetService {
flatPageLayoutWidgetMaps: existingFlatPageLayoutWidgetMaps,
flatObjectMetadataMaps: existingFlatObjectMetadataMaps,
flatFieldMetadataMaps: existingFlatFieldMetadataMaps,
flatFrontComponentMaps: existingFlatFrontComponentMaps,
flatViewFieldGroupMaps: existingFlatViewFieldGroupMaps,
flatViewMaps: existingFlatViewMaps,
});