Update pageLayout* data models for backend recordPageLayout refactor (#17446)
<img width="814" height="356" alt="Screenshot 2026-01-26 at 16 09 27" src="https://github.com/user-attachments/assets/91d95a1d-cc33-4bf0-a63e-4d1815030983" />
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Field, ObjectType, registerEnumType } from '@nestjs/graphql';
|
||||
|
||||
import { IDField } from '@ptc-org/nestjs-query-graphql';
|
||||
import { SerializedRelation } from 'twenty-shared/types';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import { PageLayoutTabDTO } from 'src/engine/metadata-modules/page-layout-tab/dtos/page-layout-tab.dto';
|
||||
@@ -28,6 +29,9 @@ export class PageLayoutDTO {
|
||||
@Field(() => [PageLayoutTabDTO], { nullable: true })
|
||||
tabs?: PageLayoutTabDTO[] | null;
|
||||
|
||||
@Field(() => UUIDScalarType, { nullable: true })
|
||||
defaultTabToFocusOnMobileAndSidePanelId?: SerializedRelation;
|
||||
|
||||
@Field()
|
||||
createdAt: Date;
|
||||
|
||||
|
||||
+10
@@ -59,6 +59,16 @@ export class PageLayoutEntity
|
||||
})
|
||||
tabs: Relation<PageLayoutTabEntity[]>;
|
||||
|
||||
@Column({ nullable: true, type: 'uuid' })
|
||||
defaultTabToFocusOnMobileAndSidePanelId: string | null;
|
||||
|
||||
@ManyToOne(() => PageLayoutTabEntity, {
|
||||
onDelete: 'SET NULL',
|
||||
nullable: true,
|
||||
})
|
||||
@JoinColumn({ name: 'defaultTabToFocusOnMobileAndSidePanelId' })
|
||||
defaultTabToFocusOnMobileAndSidePanel: Relation<PageLayoutTabEntity> | null;
|
||||
|
||||
@CreateDateColumn({ type: 'timestamptz' })
|
||||
createdAt: Date;
|
||||
|
||||
|
||||
+4
@@ -1,5 +1,6 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { PageLayoutTabLayoutMode } from 'twenty-shared/types';
|
||||
import { computeDiffBetweenObjects, isDefined } from 'twenty-shared/utils';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
@@ -236,6 +237,8 @@ export class PageLayoutUpdateService {
|
||||
universalIdentifier: tabId,
|
||||
applicationId: workspaceCustomApplicationId,
|
||||
widgetIds: [],
|
||||
icon: null,
|
||||
layoutMode: PageLayoutTabLayoutMode.GRID,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -392,6 +395,7 @@ export class PageLayoutUpdateService {
|
||||
deletedAt: null,
|
||||
universalIdentifier: widgetId,
|
||||
applicationId: workspaceCustomApplicationId,
|
||||
conditionalDisplay: null,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
+3
@@ -9,6 +9,7 @@ export const fromFlatPageLayoutToPageLayoutDto = (
|
||||
updatedAt,
|
||||
deletedAt,
|
||||
tabIds: _tabIds,
|
||||
defaultTabToFocusOnMobileAndSidePanelId,
|
||||
...rest
|
||||
} = flatPageLayout;
|
||||
|
||||
@@ -17,5 +18,7 @@ export const fromFlatPageLayoutToPageLayoutDto = (
|
||||
createdAt: new Date(createdAt),
|
||||
updatedAt: new Date(updatedAt),
|
||||
deletedAt: deletedAt ? new Date(deletedAt) : null,
|
||||
defaultTabToFocusOnMobileAndSidePanelId:
|
||||
defaultTabToFocusOnMobileAndSidePanelId ?? undefined,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user