From b71e6b060995c08b51fcfa953fee6acad143bd55 Mon Sep 17 00:00:00 2001 From: Paul Rastoin <45004772+prastoin@users.noreply.github.com> Date: Wed, 6 Aug 2025 17:10:09 +0200 Subject: [PATCH] `FlatObject/FieldMetadata` and `FlatObjectMetadataMaps` mocks (#13691) # Introduction As discussed with Charles we will introduce a new command to convert seeded twenty instance into `flatObjectMetadatas` `flatFieldMetadatas` mocks but later. We can think of this PR as a partial freeze of this command result run even tho the template might not be strictly the same in the end. For the moment we only extracted few objects with their fields in order to start testing newly introduced tools used scripts ( not committed and written on the fly ): https://gist.github.com/prastoin/bdfae0da1e3e9c66ae21c972afbd0d1e https://gist.github.com/prastoin/30029989bf57de9303e3f7ec235271ee --- .../__mocks__/attachment-flat-fields.mock.ts | 654 +++++++++++ .../__mocks__/company-flat-fields.mock.ts | 957 +++++++++++++++ .../__mocks__/note-flat-fields.mock.ts | 448 +++++++ .../__mocks__/notetarget-flat-fields.mock.ts | 475 ++++++++ .../__mocks__/opportunity-flat-fields.mock.ts | 691 +++++++++++ .../__mocks__/person-flat-fields.mock.ts | 1030 +++++++++++++++++ .../__mocks__/pet-flat-fields.mock.ts | 1005 ++++++++++++++++ .../__mocks__/rocket-flat-fields.mock.ts | 470 ++++++++ .../__mocks__/task-flat-fields.mock.ts | 572 +++++++++ .../__mocks__/tasktarget-flat-fields.mock.ts | 475 ++++++++ .../timelineactivity-flat-fields.mock.ts | 885 ++++++++++++++ .../mocks/flat-object-metadata-maps.mock.ts | 7 + .../all-flat-object-metadatas.mock.ts | 25 + .../__mocks__/all-flat-object.mock.ts | 25 + .../__mocks__/attachment-flat-object.mock.ts | 29 + .../__mocks__/company-flat-object.mock.ts | 29 + .../__mocks__/note-flat-object.mock.ts | 29 + .../__mocks__/notetarget-flat-object.mock.ts | 29 + .../__mocks__/opportunity-flat-object.mock.ts | 29 + .../__mocks__/person-flat-object.mock.ts | 29 + .../__mocks__/pet-flat-object.mock.ts | 29 + .../__mocks__/rocket-flat-object.mock.ts | 29 + .../__mocks__/task-flat-object.mock.ts | 29 + .../__mocks__/tasktarget-flat-object.mock.ts | 29 + .../timelineactivity-flat-object.mock.ts | 29 + ...datas-to-flat-object-metadata-maps.util.ts | 21 + 26 files changed, 8059 insertions(+) create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/attachment-flat-fields.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/company-flat-fields.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/note-flat-fields.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/notetarget-flat-fields.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/opportunity-flat-fields.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/person-flat-fields.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/pet-flat-fields.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/rocket-flat-fields.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/task-flat-fields.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/tasktarget-flat-fields.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/timelineactivity-flat-fields.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata-maps/mocks/flat-object-metadata-maps.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/all-flat-object-metadatas.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/all-flat-object.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/attachment-flat-object.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/company-flat-object.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/note-flat-object.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/notetarget-flat-object.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/opportunity-flat-object.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/person-flat-object.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/pet-flat-object.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/rocket-flat-object.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/task-flat-object.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/tasktarget-flat-object.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/timelineactivity-flat-object.mock.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/from-flat-object-metadatas-to-flat-object-metadata-maps.util.ts diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/attachment-flat-fields.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/attachment-flat-fields.mock.ts new file mode 100644 index 0000000000..9b63b8b489 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/attachment-flat-fields.mock.ts @@ -0,0 +1,654 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + +import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface'; +import { DateDisplayFormat } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-settings.interface'; + +import { getFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-flat-field-metadata.mock'; +import { RelationOnDeleteAction } from 'src/engine/metadata-modules/relation-metadata/relation-on-delete-action.type'; +import { FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; + +export const ATTACHMENT_FLAT_FIELDS_MOCK = { + name: getFlatFieldMetadataMock({ + id: 'f51cfa5d-7190-48a5-b548-3e542322c144', + standardId: '20202020-87a5-48f8-bbf7-ade388825a57', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.TEXT, + name: 'name', + label: 'Name', + defaultValue: "''", + description: 'Attachment name', + icon: 'IconFileUpload', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-87a5-48f8-bbf7-ade388825a57', + flatRelationTargetFieldMetadata: null, + }), + fullPath: getFlatFieldMetadataMock({ + id: '38207e43-a958-4058-bc32-36f838d102d3', + standardId: '20202020-0d19-453d-8e8d-fbcda8ca3747', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.TEXT, + name: 'fullPath', + label: 'Full path', + defaultValue: "''", + description: 'Attachment full path', + icon: 'IconLink', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-0d19-453d-8e8d-fbcda8ca3747', + flatRelationTargetFieldMetadata: null, + }), + type: getFlatFieldMetadataMock({ + id: '840360e7-efa6-4ca2-a0d6-113b79474b98', + standardId: '20202020-a417-49b8-a40b-f6a7874caa0d', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.TEXT, + name: 'type', + label: 'Type', + defaultValue: "''", + description: 'Attachment type', + icon: 'IconList', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-a417-49b8-a40b-f6a7874caa0d', + flatRelationTargetFieldMetadata: null, + }), + id: getFlatFieldMetadataMock({ + id: '8662ced6-5e48-4576-993f-1be479dba176', + standardId: '20202020-eda0-4cee-9577-3eb357e3c22b', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.UUID, + name: 'id', + label: 'Id', + defaultValue: 'uuid', + description: 'Id', + icon: 'Icon123', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-eda0-4cee-9577-3eb357e3c22b', + flatRelationTargetFieldMetadata: null, + }), + createdAt: getFlatFieldMetadataMock({ + id: '367923d5-658b-4b7b-9381-6f8e6cf84c85', + standardId: '20202020-66ac-4502-9975-e4d959c50311', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.DATE_TIME, + name: 'createdAt', + label: 'Creation date', + defaultValue: 'now', + description: 'Creation date', + icon: 'IconCalendar', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-66ac-4502-9975-e4d959c50311', + flatRelationTargetFieldMetadata: null, + }), + updatedAt: getFlatFieldMetadataMock({ + id: 'b81f8f1b-4173-4176-bc3c-fe1b6a45a0dc', + standardId: '20202020-d767-4622-bdcf-d8a084834d86', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.DATE_TIME, + name: 'updatedAt', + label: 'Last update', + defaultValue: 'now', + description: 'Last time the record was changed', + icon: 'IconCalendarClock', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-d767-4622-bdcf-d8a084834d86', + flatRelationTargetFieldMetadata: null, + }), + deletedAt: getFlatFieldMetadataMock({ + id: 'eab57da6-41ae-45e8-a5ee-014cfcab450f', + standardId: '20202020-b9a7-48d8-8387-b9a3090a50ec', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.DATE_TIME, + name: 'deletedAt', + label: 'Deleted at', + defaultValue: null, + description: 'Date when the record was deleted', + icon: 'IconCalendarMinus', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b9a7-48d8-8387-b9a3090a50ec', + flatRelationTargetFieldMetadata: null, + }), + author: getFlatFieldMetadataMock({ + id: '99724bb6-7a84-4b54-9b3f-dab730ab445a', + standardId: '20202020-6501-4ac5-a4ef-b2f8522ef6cd', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'author', + label: 'Author', + defaultValue: null, + description: 'Attachment author', + icon: 'IconCircleUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'authorId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '958b82d0-a290-4e10-898d-3d858fbf684f', + relationTargetObjectMetadataId: '7d8264db-2b55-4b74-81ff-b7064ed43840', + uniqueIdentifier: '20202020-6501-4ac5-a4ef-b2f8522ef6cd', + flatRelationTargetFieldMetadata: { + id: '958b82d0-a290-4e10-898d-3d858fbf684f', + standardId: '20202020-000f-4947-917f-1b09851024fe', + objectMetadataId: '7d8264db-2b55-4b74-81ff-b7064ed43840', + type: FieldMetadataType.RELATION, + name: 'authoredAttachments', + label: 'Authored attachments', + defaultValue: null, + description: 'Attachments created by the workspace member', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '99724bb6-7a84-4b54-9b3f-dab730ab445a', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-000f-4947-917f-1b09851024fe', + }, + }), + task: getFlatFieldMetadataMock({ + id: 'bd823f17-f923-4f0d-8533-51d7bc062975', + standardId: '20202020-51e5-4621-9cf8-215487951c4b', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'task', + label: 'Task', + defaultValue: null, + description: 'Attachment task', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'taskId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '00fd339a-6431-465d-9524-09b5c804f497', + relationTargetObjectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + uniqueIdentifier: '20202020-51e5-4621-9cf8-215487951c4b', + flatRelationTargetFieldMetadata: { + id: '00fd339a-6431-465d-9524-09b5c804f497', + standardId: '20202020-794d-4783-a8ff-cecdb15be139', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Task attachments', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'bd823f17-f923-4f0d-8533-51d7bc062975', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-794d-4783-a8ff-cecdb15be139', + }, + }), + note: getFlatFieldMetadataMock({ + id: '5a98eb2b-1120-42e3-afd3-09d7da642fba', + standardId: '20202020-4f4b-4503-a6fc-6b982f3dffb5', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'note', + label: 'Note', + defaultValue: null, + description: 'Attachment note', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'noteId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '4d4b3225-ddd2-4d76-a4d6-bcdd43a256e8', + relationTargetObjectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + uniqueIdentifier: '20202020-4f4b-4503-a6fc-6b982f3dffb5', + flatRelationTargetFieldMetadata: { + id: '4d4b3225-ddd2-4d76-a4d6-bcdd43a256e8', + standardId: '20202020-4986-4c92-bf19-39934b149b16', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Note attachments', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '5a98eb2b-1120-42e3-afd3-09d7da642fba', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-4986-4c92-bf19-39934b149b16', + }, + }), + person: getFlatFieldMetadataMock({ + id: '6938c2ec-ebcc-4f30-8d38-2c9c40228c53', + standardId: '20202020-0158-4aa2-965c-5cdafe21ffa2', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'person', + label: 'Person', + defaultValue: null, + description: 'Attachment person', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'personId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '367ad117-de09-466c-94f8-ce99d951b5ce', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-0158-4aa2-965c-5cdafe21ffa2', + flatRelationTargetFieldMetadata: { + id: '367ad117-de09-466c-94f8-ce99d951b5ce', + standardId: '20202020-cd97-451f-87fa-bcb789bdbf3a', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Attachments linked to the contact.', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '6938c2ec-ebcc-4f30-8d38-2c9c40228c53', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-cd97-451f-87fa-bcb789bdbf3a', + }, + }), + company: getFlatFieldMetadataMock({ + id: '0bacf73b-f45b-4683-85b4-3e812e6228bf', + standardId: '20202020-ceab-4a28-b546-73b06b4c08d5', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'company', + label: 'Company', + defaultValue: null, + description: 'Attachment company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'companyId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '44a572c5-d620-47f5-943a-346ae967e99e', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: '20202020-ceab-4a28-b546-73b06b4c08d5', + flatRelationTargetFieldMetadata: { + id: '44a572c5-d620-47f5-943a-346ae967e99e', + standardId: '20202020-c1b5-4120-b0f0-987ca401ed53', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Attachments linked to the company', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '0bacf73b-f45b-4683-85b4-3e812e6228bf', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-c1b5-4120-b0f0-987ca401ed53', + }, + }), + opportunity: getFlatFieldMetadataMock({ + id: 'da72fbe2-a5aa-42b5-b6bd-482a3919eb20', + standardId: '20202020-7374-499d-bea3-9354890755b5', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'opportunity', + label: 'Opportunity', + defaultValue: null, + description: 'Attachment opportunity', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'opportunityId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '16515578-a6ce-48af-a303-2005bb8492f0', + relationTargetObjectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + uniqueIdentifier: '20202020-7374-499d-bea3-9354890755b5', + flatRelationTargetFieldMetadata: { + id: '16515578-a6ce-48af-a303-2005bb8492f0', + standardId: '20202020-87c7-4118-83d6-2f4031005209', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Attachments linked to the opportunity', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'da72fbe2-a5aa-42b5-b6bd-482a3919eb20', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-87c7-4118-83d6-2f4031005209', + }, + }), + rocket: getFlatFieldMetadataMock({ + id: 'ba23019c-7f25-42c3-8138-622e61c42968', + standardId: '20202020-ca2d-47c0-8253-9d0b662fb01a', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'rocket', + label: 'Rocket', + defaultValue: null, + description: 'Attachments Rocket', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'rocketId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'f5984acf-5128-42ac-840f-9d2888423699', + relationTargetObjectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + uniqueIdentifier: '20202020-ca2d-47c0-8253-9d0b662fb01a', + flatRelationTargetFieldMetadata: { + id: 'f5984acf-5128-42ac-840f-9d2888423699', + standardId: '20202020-8d59-46ca-b7b2-73d167712134', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Attachments tied to the Rocket', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'ba23019c-7f25-42c3-8138-622e61c42968', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-8d59-46ca-b7b2-73d167712134', + }, + }), + pet: getFlatFieldMetadataMock({ + id: '317a33ef-117e-4953-86d4-c4a9670a2ce3', + standardId: '20202020-b715-4658-8b6a-5359824dbddd', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'pet', + label: 'Pet', + defaultValue: null, + description: 'Attachments Pet', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'petId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '231903d0-3b14-47ed-9a88-fbf11031c451', + relationTargetObjectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + uniqueIdentifier: '20202020-b715-4658-8b6a-5359824dbddd', + flatRelationTargetFieldMetadata: { + id: '231903d0-3b14-47ed-9a88-fbf11031c451', + standardId: '20202020-8d59-46ca-b7b2-73d167712134', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Attachments tied to the Pet', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '317a33ef-117e-4953-86d4-c4a9670a2ce3', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-8d59-46ca-b7b2-73d167712134', + }, + }), + surveyResult: getFlatFieldMetadataMock({ + id: 'a09463e6-5e56-4965-bc8a-2faa23a64672', + standardId: '20202020-58b5-4f6c-8402-06b2bf3ea064', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'surveyResult', + label: 'Survey result', + defaultValue: null, + description: 'Attachments Survey result', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'surveyResultId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '3347ffcc-43d0-4697-a9ce-6fb9b0e677e1', + relationTargetObjectMetadataId: '713da753-0340-49b5-b1fa-add34d2dc9a8', + uniqueIdentifier: '20202020-58b5-4f6c-8402-06b2bf3ea064', + flatRelationTargetFieldMetadata: { + id: '3347ffcc-43d0-4697-a9ce-6fb9b0e677e1', + standardId: '20202020-8d59-46ca-b7b2-73d167712134', + objectMetadataId: '713da753-0340-49b5-b1fa-add34d2dc9a8', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Attachments tied to the Survey result', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'a09463e6-5e56-4965-bc8a-2faa23a64672', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-8d59-46ca-b7b2-73d167712134', + }, + }), +} as const satisfies Record; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/company-flat-fields.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/company-flat-fields.mock.ts new file mode 100644 index 0000000000..6b86676c22 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/company-flat-fields.mock.ts @@ -0,0 +1,957 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + +import { DateDisplayFormat } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-settings.interface'; +import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface'; + +import { getFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-flat-field-metadata.mock'; +import { FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; +import { RelationOnDeleteAction } from 'src/engine/metadata-modules/relation-metadata/relation-on-delete-action.type'; + +export const COMPANY_FLAT_FIELDS_MOCK = { + name: getFlatFieldMetadataMock({ + id: '12b304b6-ea97-4dcc-9415-9f7b2ac4b729', + standardId: '20202020-4d99-4e2e-a84c-4a27837b1ece', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.TEXT, + name: 'name', + label: 'Name', + defaultValue: "''", + description: 'The company name', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-4d99-4e2e-a84c-4a27837b1ece', + flatRelationTargetFieldMetadata: null, + }), + domainName: getFlatFieldMetadataMock({ + id: 'f4b67402-1686-491f-a3c7-f70ac9b021cf', + standardId: '20202020-0c28-43d8-8ba5-3659924d3489', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.LINKS, + name: 'domainName', + label: 'Domain Name', + defaultValue: { + primaryLinkUrl: "''", + secondaryLinks: [], + primaryLinkLabel: "''", + }, + description: + 'The company website URL. We use this url to fetch the company icon', + icon: 'IconLink', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: true, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-0c28-43d8-8ba5-3659924d3489', + flatRelationTargetFieldMetadata: null, + }), + employees: getFlatFieldMetadataMock({ + id: '721d26f0-238d-4d55-a1a2-62f915631c4d', + standardId: '20202020-8965-464a-8a75-74bafc152a0b', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.NUMBER, + name: 'employees', + label: 'Employees', + defaultValue: null, + description: 'Number of employees in the company', + icon: 'IconUsers', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-8965-464a-8a75-74bafc152a0b', + flatRelationTargetFieldMetadata: null, + }), + linkedinLink: getFlatFieldMetadataMock({ + id: '6acb80a0-dab8-4d97-a0c8-15e4a495fb54', + standardId: '20202020-ebeb-4beb-b9ad-6848036fb451', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.LINKS, + name: 'linkedinLink', + label: 'Linkedin', + defaultValue: { + primaryLinkUrl: "''", + secondaryLinks: [], + primaryLinkLabel: "''", + }, + description: 'The company Linkedin account', + icon: 'IconBrandLinkedin', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-ebeb-4beb-b9ad-6848036fb451', + flatRelationTargetFieldMetadata: null, + }), + xLink: getFlatFieldMetadataMock({ + id: 'fc630bbb-aa2c-4554-aa4f-9afc0b0567f9', + standardId: '20202020-6f64-4fd9-9580-9c1991c7d8c3', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.LINKS, + name: 'xLink', + label: 'X', + defaultValue: { + primaryLinkUrl: "''", + secondaryLinks: [], + primaryLinkLabel: "''", + }, + description: 'The company Twitter/X account', + icon: 'IconBrandX', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-6f64-4fd9-9580-9c1991c7d8c3', + flatRelationTargetFieldMetadata: null, + }), + annualRecurringRevenue: getFlatFieldMetadataMock({ + id: '1e34d871-3e1a-4903-850e-1e4bc6b1d72b', + standardId: '20202020-602a-495c-9776-f5d5b11d227b', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.CURRENCY, + name: 'annualRecurringRevenue', + label: 'ARR', + defaultValue: { amountMicros: null, currencyCode: "''" }, + description: + 'Annual Recurring Revenue: The actual or estimated annual revenue of the company', + icon: 'IconMoneybag', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-602a-495c-9776-f5d5b11d227b', + flatRelationTargetFieldMetadata: null, + }), + address: getFlatFieldMetadataMock({ + id: '1bd4dc61-e644-4a9e-8899-cacdf43571a1', + standardId: '20202020-c5ce-4adc-b7b6-9c0979fc55e7', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.ADDRESS, + name: 'address', + label: 'Address', + defaultValue: { + addressLat: null, + addressLng: null, + addressCity: "''", + addressState: "''", + addressCountry: "''", + addressStreet1: "''", + addressStreet2: "''", + addressPostcode: "''", + }, + description: 'Address of the company', + icon: 'IconMap', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-c5ce-4adc-b7b6-9c0979fc55e7', + flatRelationTargetFieldMetadata: null, + }), + idealCustomerProfile: getFlatFieldMetadataMock({ + id: '8b75a4f1-dc7d-4fa3-b778-616ab9128c31', + standardId: '20202020-ba6b-438a-8213-2c5ba28d76a2', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.BOOLEAN, + name: 'idealCustomerProfile', + label: 'ICP', + defaultValue: false, + description: + 'Ideal Customer Profile: Indicates whether the company is the most suitable and valuable customer for you', + icon: 'IconTarget', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-ba6b-438a-8213-2c5ba28d76a2', + flatRelationTargetFieldMetadata: null, + }), + position: getFlatFieldMetadataMock({ + id: 'ed081dac-ff61-4fe1-bc2c-073644b61c28', + standardId: '20202020-9b4e-462b-991d-a0ee33326454', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + defaultValue: 0, + description: 'Company record position', + icon: 'IconHierarchy2', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-9b4e-462b-991d-a0ee33326454', + flatRelationTargetFieldMetadata: null, + }), + createdBy: getFlatFieldMetadataMock({ + id: 'dbbddd40-a72b-47fe-9ecf-9bdd4282369a', + standardId: '20202020-fabc-451d-ab7d-412170916baa', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + defaultValue: { + name: "'System'", + source: "'MANUAL'", + workspaceMemberId: null, + }, + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-fabc-451d-ab7d-412170916baa', + flatRelationTargetFieldMetadata: null, + }), + searchVector: getFlatFieldMetadataMock({ + id: 'b2850ac5-d368-44ab-bc79-b1bf7212e5fb', + standardId: '85c71601-72f9-4b7b-b343-d46100b2c74d', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + defaultValue: null, + description: 'Field used for full-text search', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '85c71601-72f9-4b7b-b343-d46100b2c74d', + flatRelationTargetFieldMetadata: null, + }), + id: getFlatFieldMetadataMock({ + id: '982dff40-66c9-4b9b-b3ec-8fa7076ea3a6', + standardId: '20202020-eda0-4cee-9577-3eb357e3c22b', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.UUID, + name: 'id', + label: 'Id', + defaultValue: 'uuid', + description: 'Id', + icon: 'Icon123', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-eda0-4cee-9577-3eb357e3c22b', + flatRelationTargetFieldMetadata: null, + }), + createdAt: getFlatFieldMetadataMock({ + id: 'e2f65a26-0210-4f22-954b-7d448abbdb28', + standardId: '20202020-66ac-4502-9975-e4d959c50311', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.DATE_TIME, + name: 'createdAt', + label: 'Creation date', + defaultValue: 'now', + description: 'Creation date', + icon: 'IconCalendar', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-66ac-4502-9975-e4d959c50311', + flatRelationTargetFieldMetadata: null, + }), + updatedAt: getFlatFieldMetadataMock({ + id: '26518091-a31b-4716-8627-4e2d25bc0e60', + standardId: '20202020-d767-4622-bdcf-d8a084834d86', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.DATE_TIME, + name: 'updatedAt', + label: 'Last update', + defaultValue: 'now', + description: 'Last time the record was changed', + icon: 'IconCalendarClock', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-d767-4622-bdcf-d8a084834d86', + flatRelationTargetFieldMetadata: null, + }), + deletedAt: getFlatFieldMetadataMock({ + id: '29ba1ee7-fc21-441c-8acc-45d9e56751e3', + standardId: '20202020-b9a7-48d8-8387-b9a3090a50ec', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.DATE_TIME, + name: 'deletedAt', + label: 'Deleted at', + defaultValue: null, + description: 'Date when the record was deleted', + icon: 'IconCalendarMinus', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b9a7-48d8-8387-b9a3090a50ec', + flatRelationTargetFieldMetadata: null, + }), + people: getFlatFieldMetadataMock({ + id: 'b0563539-f027-40c5-a14c-ee7a25ff6fd9', + standardId: '20202020-3213-4ddf-9494-6422bcff8d7c', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'people', + label: 'People', + defaultValue: null, + description: 'People linked to the company.', + icon: 'IconUsers', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'ee247ca6-fdaa-4a56-87a2-730cf84f5f29', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-3213-4ddf-9494-6422bcff8d7c', + flatRelationTargetFieldMetadata: { + id: 'ee247ca6-fdaa-4a56-87a2-730cf84f5f29', + standardId: '20202020-e2f3-448e-b34c-2d625f0025fd', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'company', + label: 'Company', + defaultValue: null, + description: 'Contact’s company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'companyId', + }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'b0563539-f027-40c5-a14c-ee7a25ff6fd9', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: '20202020-e2f3-448e-b34c-2d625f0025fd', + }, + }), + accountOwner: getFlatFieldMetadataMock({ + id: '86c6692b-bed5-4ef1-bad0-657e56a85eba', + standardId: '20202020-95b8-4e10-9881-edb5d4765f9d', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'accountOwner', + label: 'Account Owner', + defaultValue: null, + description: + 'Your team member responsible for managing the company account', + icon: 'IconUserCircle', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'accountOwnerId', + }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '1fe5453f-6042-4370-b388-c9a198bd0ab4', + relationTargetObjectMetadataId: '7d8264db-2b55-4b74-81ff-b7064ed43840', + uniqueIdentifier: '20202020-95b8-4e10-9881-edb5d4765f9d', + flatRelationTargetFieldMetadata: { + id: '1fe5453f-6042-4370-b388-c9a198bd0ab4', + standardId: '20202020-dc29-4bd4-a3c1-29eafa324bee', + objectMetadataId: '7d8264db-2b55-4b74-81ff-b7064ed43840', + type: FieldMetadataType.RELATION, + name: 'accountOwnerForCompanies', + label: 'Account Owner For Companies', + defaultValue: null, + description: 'Account owner for companies', + icon: 'IconBriefcase', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '86c6692b-bed5-4ef1-bad0-657e56a85eba', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: '20202020-dc29-4bd4-a3c1-29eafa324bee', + }, + }), + taskTargets: getFlatFieldMetadataMock({ + id: '4f9138da-cd36-4df4-98f9-ebabe036b141', + standardId: '20202020-cb17-4a61-8f8f-3be6730480de', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'taskTargets', + label: 'Tasks', + defaultValue: null, + description: 'Tasks tied to the company', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'ec11b025-1476-4e84-81c5-cf5b5c776edc', + relationTargetObjectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + uniqueIdentifier: '20202020-cb17-4a61-8f8f-3be6730480de', + flatRelationTargetFieldMetadata: { + id: 'ec11b025-1476-4e84-81c5-cf5b5c776edc', + standardId: '20202020-4703-4a4e-948c-487b0c60a92c', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.RELATION, + name: 'company', + label: 'Company', + defaultValue: null, + description: 'TaskTarget company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'companyId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '4f9138da-cd36-4df4-98f9-ebabe036b141', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: '20202020-4703-4a4e-948c-487b0c60a92c', + }, + }), + noteTargets: getFlatFieldMetadataMock({ + id: '56b9dc8a-0379-42cf-ab31-8db7061f5a2a', + standardId: '20202020-bae0-4556-a74a-a9c686f77a88', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'noteTargets', + label: 'Notes', + defaultValue: null, + description: 'Notes tied to the company', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'd1d3f9eb-1447-4adb-bc2b-f133bc58ac35', + relationTargetObjectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + uniqueIdentifier: '20202020-bae0-4556-a74a-a9c686f77a88', + flatRelationTargetFieldMetadata: { + id: 'd1d3f9eb-1447-4adb-bc2b-f133bc58ac35', + standardId: 'c500fbc0-d6f2-4982-a959-5a755431696c', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.RELATION, + name: 'company', + label: 'Company', + defaultValue: null, + description: 'NoteTarget company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'companyId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '56b9dc8a-0379-42cf-ab31-8db7061f5a2a', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: 'c500fbc0-d6f2-4982-a959-5a755431696c', + }, + }), + opportunities: getFlatFieldMetadataMock({ + id: '3eda8c8e-74e4-401f-bb0e-470db5b267e6', + standardId: '20202020-add3-4658-8e23-d70dccb6d0ec', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'opportunities', + label: 'Opportunities', + defaultValue: null, + description: 'Opportunities linked to the company.', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '512890f1-4da0-4b96-bb71-5ccabefb82e7', + relationTargetObjectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + uniqueIdentifier: '20202020-add3-4658-8e23-d70dccb6d0ec', + flatRelationTargetFieldMetadata: { + id: '512890f1-4da0-4b96-bb71-5ccabefb82e7', + standardId: '20202020-cbac-457e-b565-adece5fc815f', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.RELATION, + name: 'company', + label: 'Company', + defaultValue: null, + description: 'Opportunity company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'companyId', + }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '3eda8c8e-74e4-401f-bb0e-470db5b267e6', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: '20202020-cbac-457e-b565-adece5fc815f', + }, + }), + favorites: getFlatFieldMetadataMock({ + id: '72415216-fed4-450b-aa00-691e37718b01', + standardId: '20202020-4d1d-41ac-b13b-621631298d55', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'favorites', + label: 'Favorites', + defaultValue: null, + description: 'Favorites linked to the company', + icon: 'IconHeart', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '9a11532c-6839-46ed-a2f5-ed03f88b86f6', + relationTargetObjectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + uniqueIdentifier: '20202020-4d1d-41ac-b13b-621631298d55', + flatRelationTargetFieldMetadata: { + id: '9a11532c-6839-46ed-a2f5-ed03f88b86f6', + standardId: '20202020-cff5-4682-8bf9-069169e08279', + objectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + type: FieldMetadataType.RELATION, + name: 'company', + label: 'Company', + defaultValue: null, + description: 'Favorite company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'companyId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '72415216-fed4-450b-aa00-691e37718b01', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: '20202020-cff5-4682-8bf9-069169e08279', + }, + }), + attachments: getFlatFieldMetadataMock({ + id: '44a572c5-d620-47f5-943a-346ae967e99e', + standardId: '20202020-c1b5-4120-b0f0-987ca401ed53', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Attachments linked to the company', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '0bacf73b-f45b-4683-85b4-3e812e6228bf', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-c1b5-4120-b0f0-987ca401ed53', + flatRelationTargetFieldMetadata: { + id: '0bacf73b-f45b-4683-85b4-3e812e6228bf', + standardId: '20202020-ceab-4a28-b546-73b06b4c08d5', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'company', + label: 'Company', + defaultValue: null, + description: 'Attachment company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'companyId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '44a572c5-d620-47f5-943a-346ae967e99e', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: '20202020-ceab-4a28-b546-73b06b4c08d5', + }, + }), + timelineActivities: getFlatFieldMetadataMock({ + id: 'cc78390f-f570-4c2c-9f19-2a8fef67f4f6', + standardId: '20202020-0414-4daf-9c0d-64fe7b27f89f', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Timeline Activities', + defaultValue: null, + description: 'Timeline Activities linked to the company', + icon: 'IconIconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'fd8cabe5-7dc8-4d6a-8053-43434488b3e4', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-0414-4daf-9c0d-64fe7b27f89f', + flatRelationTargetFieldMetadata: { + id: 'fd8cabe5-7dc8-4d6a-8053-43434488b3e4', + standardId: '20202020-04ad-4221-a744-7a8278a5ce21', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'company', + label: 'Company', + defaultValue: null, + description: 'Event company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'companyId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'cc78390f-f570-4c2c-9f19-2a8fef67f4f6', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: '20202020-04ad-4221-a744-7a8278a5ce21', + }, + }), + tagline: getFlatFieldMetadataMock({ + id: 'f869f4ed-e440-486a-8392-be33ab327cf4', + standardId: null, + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.TEXT, + name: 'tagline', + label: 'Tagline', + defaultValue: "''", + description: null, + icon: 'IconAdCircle', + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: 'f869f4ed-e440-486a-8392-be33ab327cf4', + flatRelationTargetFieldMetadata: null, + }), + introVideo: getFlatFieldMetadataMock({ + id: '339b52b7-adfb-4bd3-ae42-0697da92c0fa', + standardId: null, + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.LINKS, + name: 'introVideo', + label: 'Intro Video', + defaultValue: { + primaryLinkUrl: "''", + secondaryLinks: [], + primaryLinkLabel: "''", + }, + description: null, + icon: 'IconVideo', + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '339b52b7-adfb-4bd3-ae42-0697da92c0fa', + flatRelationTargetFieldMetadata: null, + }), + workPolicy: getFlatFieldMetadataMock({ + id: '74c546c1-b183-41d0-ac20-aecde83bf674', + standardId: null, + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.MULTI_SELECT, + name: 'workPolicy', + label: 'Work Policy', + defaultValue: null, + description: null, + icon: 'IconHome', + standardOverrides: null, + options: [ + { + id: '325240d6-8c67-4fb2-bb02-51e9de4cd6be', + color: 'green', + label: 'On-Site', + value: 'ON_SITE', + position: 0, + }, + { + id: 'dcf5b58a-945f-4e21-9146-e5ed6adebd32', + color: 'turquoise', + label: 'Hybrid', + value: 'HYBRID', + position: 1, + }, + { + id: '0c17887a-8f49-48ae-9d6b-1034f2b2fc03', + color: 'sky', + label: 'Remote Work', + value: 'REMOTE_WORK', + position: 2, + }, + ], + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '74c546c1-b183-41d0-ac20-aecde83bf674', + flatRelationTargetFieldMetadata: null, + }), + visaSponsorship: getFlatFieldMetadataMock({ + id: '5e48697e-a3d0-4faa-b79c-bddd8c7ae17f', + standardId: null, + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.BOOLEAN, + name: 'visaSponsorship', + label: 'Visa Sponsorship', + defaultValue: false, + description: null, + icon: 'IconBrandVisa', + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '5e48697e-a3d0-4faa-b79c-bddd8c7ae17f', + flatRelationTargetFieldMetadata: null, + }), +} as const satisfies Record; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/note-flat-fields.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/note-flat-fields.mock.ts new file mode 100644 index 0000000000..6b156b4d37 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/note-flat-fields.mock.ts @@ -0,0 +1,448 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + +import { DateDisplayFormat } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-settings.interface'; +import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface'; + +import { getFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-flat-field-metadata.mock'; +import { FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; +import { RelationOnDeleteAction } from 'src/engine/metadata-modules/relation-metadata/relation-on-delete-action.type'; + +export const NOTE_FLAT_FIELDS_MOCK = { + position: getFlatFieldMetadataMock({ + id: '3ea4b48b-3b88-4db5-b455-c7c77b208599', + standardId: '20202020-368d-4dc2-943f-ed8a49c7fdfb', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + defaultValue: 0, + description: 'Note record position', + icon: 'IconHierarchy2', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-368d-4dc2-943f-ed8a49c7fdfb', + flatRelationTargetFieldMetadata: null, + }), + title: getFlatFieldMetadataMock({ + id: '3cb30a3f-31c1-47d3-a61e-e537615390c8', + standardId: '20202020-faeb-4c76-8ba6-ccbb0b4a965f', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.TEXT, + name: 'title', + label: 'Title', + defaultValue: "''", + description: 'Note title', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-faeb-4c76-8ba6-ccbb0b4a965f', + flatRelationTargetFieldMetadata: null, + }), + bodyV2: getFlatFieldMetadataMock({ + id: 'acb2973c-7e46-4296-ac79-8b8d163b6d85', + standardId: '20202020-a7bb-4d94-be51-8f25181502c8', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.RICH_TEXT_V2, + name: 'bodyV2', + label: 'Body', + defaultValue: null, + description: 'Note body', + icon: 'IconFilePencil', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-a7bb-4d94-be51-8f25181502c8', + flatRelationTargetFieldMetadata: null, + }), + createdBy: getFlatFieldMetadataMock({ + id: '1caa79de-f2ec-405c-8667-7a65e9a3bcbf', + standardId: '20202020-0d79-4e21-ab77-5a394eff97be', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + defaultValue: { + name: "'System'", + source: "'MANUAL'", + workspaceMemberId: null, + }, + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-0d79-4e21-ab77-5a394eff97be', + flatRelationTargetFieldMetadata: null, + }), + searchVector: getFlatFieldMetadataMock({ + id: '597b0c10-840e-4ba5-99db-7ef834a72bed', + standardId: '20202020-7ea8-44d4-9d4c-51dd2a757950', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + defaultValue: null, + description: 'Field used for full-text search', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-7ea8-44d4-9d4c-51dd2a757950', + flatRelationTargetFieldMetadata: null, + }), + id: getFlatFieldMetadataMock({ + id: '6ece96a9-2948-4735-8c8a-40cdb76e23b8', + standardId: '20202020-eda0-4cee-9577-3eb357e3c22b', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.UUID, + name: 'id', + label: 'Id', + defaultValue: 'uuid', + description: 'Id', + icon: 'Icon123', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-eda0-4cee-9577-3eb357e3c22b', + flatRelationTargetFieldMetadata: null, + }), + createdAt: getFlatFieldMetadataMock({ + id: '0b849709-eee4-4d63-9fef-058cfdd0c098', + standardId: '20202020-66ac-4502-9975-e4d959c50311', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.DATE_TIME, + name: 'createdAt', + label: 'Creation date', + defaultValue: 'now', + description: 'Creation date', + icon: 'IconCalendar', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-66ac-4502-9975-e4d959c50311', + flatRelationTargetFieldMetadata: null, + }), + updatedAt: getFlatFieldMetadataMock({ + id: '8b4fe2dd-f4fa-4365-964d-d8f0dd7890cd', + standardId: '20202020-d767-4622-bdcf-d8a084834d86', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.DATE_TIME, + name: 'updatedAt', + label: 'Last update', + defaultValue: 'now', + description: 'Last time the record was changed', + icon: 'IconCalendarClock', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-d767-4622-bdcf-d8a084834d86', + flatRelationTargetFieldMetadata: null, + }), + deletedAt: getFlatFieldMetadataMock({ + id: 'fbf20b48-0aca-49a2-b3a8-67d0d7dfe104', + standardId: '20202020-b9a7-48d8-8387-b9a3090a50ec', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.DATE_TIME, + name: 'deletedAt', + label: 'Deleted at', + defaultValue: null, + description: 'Date when the record was deleted', + icon: 'IconCalendarMinus', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b9a7-48d8-8387-b9a3090a50ec', + flatRelationTargetFieldMetadata: null, + }), + noteTargets: getFlatFieldMetadataMock({ + id: '3a13d398-b7e6-4871-a5f8-5446806b3e5b', + standardId: '20202020-1f25-43fe-8b00-af212fdde823', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.RELATION, + name: 'noteTargets', + label: 'Relations', + defaultValue: null, + description: 'Note targets', + icon: 'IconArrowUpRight', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'b1e812b7-604e-459b-9449-31fa414b315c', + relationTargetObjectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + uniqueIdentifier: '20202020-1f25-43fe-8b00-af212fdde823', + flatRelationTargetFieldMetadata: { + id: 'b1e812b7-604e-459b-9449-31fa414b315c', + standardId: '20202020-57f3-4f50-9599-fc0f671df003', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.RELATION, + name: 'note', + label: 'Note', + defaultValue: null, + description: 'NoteTarget note', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'noteId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '3a13d398-b7e6-4871-a5f8-5446806b3e5b', + relationTargetObjectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + uniqueIdentifier: '20202020-57f3-4f50-9599-fc0f671df003', + }, + }), + attachments: getFlatFieldMetadataMock({ + id: '4d4b3225-ddd2-4d76-a4d6-bcdd43a256e8', + standardId: '20202020-4986-4c92-bf19-39934b149b16', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Note attachments', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '5a98eb2b-1120-42e3-afd3-09d7da642fba', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-4986-4c92-bf19-39934b149b16', + flatRelationTargetFieldMetadata: { + id: '5a98eb2b-1120-42e3-afd3-09d7da642fba', + standardId: '20202020-4f4b-4503-a6fc-6b982f3dffb5', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'note', + label: 'Note', + defaultValue: null, + description: 'Attachment note', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'noteId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '4d4b3225-ddd2-4d76-a4d6-bcdd43a256e8', + relationTargetObjectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + uniqueIdentifier: '20202020-4f4b-4503-a6fc-6b982f3dffb5', + }, + }), + timelineActivities: getFlatFieldMetadataMock({ + id: '1207d260-db2c-41d4-bb09-34ea1188978f', + standardId: '20202020-7030-42f8-929c-1a57b25d6bce', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Timeline Activities', + defaultValue: null, + description: 'Timeline Activities linked to the note.', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '2b9f1c90-9e35-4ccc-8d84-b42de31ef127', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-7030-42f8-929c-1a57b25d6bce', + flatRelationTargetFieldMetadata: { + id: '2b9f1c90-9e35-4ccc-8d84-b42de31ef127', + standardId: '20202020-ec55-4135-8da5-3a20badc0156', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'note', + label: 'Note', + defaultValue: null, + description: 'Event note', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'noteId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '1207d260-db2c-41d4-bb09-34ea1188978f', + relationTargetObjectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + uniqueIdentifier: '20202020-ec55-4135-8da5-3a20badc0156', + }, + }), + favorites: getFlatFieldMetadataMock({ + id: '065a1ede-f773-48ca-84bf-70f61d838396', + standardId: '20202020-4d1d-41ac-b13b-621631298d67', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.RELATION, + name: 'favorites', + label: 'Favorites', + defaultValue: null, + description: 'Favorites linked to the note', + icon: 'IconHeart', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'a61baf0f-2d43-4fda-9baf-efb000c17ecd', + relationTargetObjectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + uniqueIdentifier: '20202020-4d1d-41ac-b13b-621631298d67', + flatRelationTargetFieldMetadata: { + id: 'a61baf0f-2d43-4fda-9baf-efb000c17ecd', + standardId: '20202020-1f25-43fe-8b00-af212fdde824', + objectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + type: FieldMetadataType.RELATION, + name: 'note', + label: 'Note', + defaultValue: null, + description: 'Favorite note', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'noteId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '065a1ede-f773-48ca-84bf-70f61d838396', + relationTargetObjectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + uniqueIdentifier: '20202020-1f25-43fe-8b00-af212fdde824', + }, + }), +} as const satisfies Record; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/notetarget-flat-fields.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/notetarget-flat-fields.mock.ts new file mode 100644 index 0000000000..a8074b2733 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/notetarget-flat-fields.mock.ts @@ -0,0 +1,475 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + +import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface'; +import { DateDisplayFormat } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-settings.interface'; + +import { getFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-flat-field-metadata.mock'; +import { RelationOnDeleteAction } from 'src/engine/metadata-modules/relation-metadata/relation-on-delete-action.type'; +import { FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; + +export const NOTETARGET_FLAT_FIELDS_MOCK = { + id: getFlatFieldMetadataMock({ + id: '3ef6c3df-6569-4d00-b1ae-3893e8e55a7e', + standardId: '20202020-eda0-4cee-9577-3eb357e3c22b', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.UUID, + name: 'id', + label: 'Id', + defaultValue: 'uuid', + description: 'Id', + icon: 'Icon123', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-eda0-4cee-9577-3eb357e3c22b', + flatRelationTargetFieldMetadata: null, + }), + createdAt: getFlatFieldMetadataMock({ + id: '3cecf38d-1186-4e66-9eb6-06516d3b3172', + standardId: '20202020-66ac-4502-9975-e4d959c50311', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.DATE_TIME, + name: 'createdAt', + label: 'Creation date', + defaultValue: 'now', + description: 'Creation date', + icon: 'IconCalendar', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-66ac-4502-9975-e4d959c50311', + flatRelationTargetFieldMetadata: null, + }), + updatedAt: getFlatFieldMetadataMock({ + id: '41e0ee99-7319-4709-a11a-b0d624625359', + standardId: '20202020-d767-4622-bdcf-d8a084834d86', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.DATE_TIME, + name: 'updatedAt', + label: 'Last update', + defaultValue: 'now', + description: 'Last time the record was changed', + icon: 'IconCalendarClock', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-d767-4622-bdcf-d8a084834d86', + flatRelationTargetFieldMetadata: null, + }), + deletedAt: getFlatFieldMetadataMock({ + id: '3ef1221e-649f-41f9-a360-12896e3c0935', + standardId: '20202020-b9a7-48d8-8387-b9a3090a50ec', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.DATE_TIME, + name: 'deletedAt', + label: 'Deleted at', + defaultValue: null, + description: 'Date when the record was deleted', + icon: 'IconCalendarMinus', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b9a7-48d8-8387-b9a3090a50ec', + flatRelationTargetFieldMetadata: null, + }), + note: getFlatFieldMetadataMock({ + id: 'b1e812b7-604e-459b-9449-31fa414b315c', + standardId: '20202020-57f3-4f50-9599-fc0f671df003', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.RELATION, + name: 'note', + label: 'Note', + defaultValue: null, + description: 'NoteTarget note', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'noteId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '3a13d398-b7e6-4871-a5f8-5446806b3e5b', + relationTargetObjectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + uniqueIdentifier: '20202020-57f3-4f50-9599-fc0f671df003', + flatRelationTargetFieldMetadata: { + id: '3a13d398-b7e6-4871-a5f8-5446806b3e5b', + standardId: '20202020-1f25-43fe-8b00-af212fdde823', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.RELATION, + name: 'noteTargets', + label: 'Relations', + defaultValue: null, + description: 'Note targets', + icon: 'IconArrowUpRight', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'b1e812b7-604e-459b-9449-31fa414b315c', + relationTargetObjectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + uniqueIdentifier: '20202020-1f25-43fe-8b00-af212fdde823', + }, + }), + person: getFlatFieldMetadataMock({ + id: '560c71ff-254f-4baf-a4d1-054c53444f41', + standardId: '20202020-38ca-4aab-92f5-8a605ca2e4c5', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.RELATION, + name: 'person', + label: 'Person', + defaultValue: null, + description: 'NoteTarget person', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'personId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '60388ed8-45f6-4fb5-8752-81c73e13f4ab', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-38ca-4aab-92f5-8a605ca2e4c5', + flatRelationTargetFieldMetadata: { + id: '60388ed8-45f6-4fb5-8752-81c73e13f4ab', + standardId: '20202020-c8fc-4258-8250-15905d3fcfec', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'noteTargets', + label: 'Notes', + defaultValue: null, + description: 'Notes tied to the contact', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '560c71ff-254f-4baf-a4d1-054c53444f41', + relationTargetObjectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + uniqueIdentifier: '20202020-c8fc-4258-8250-15905d3fcfec', + }, + }), + company: getFlatFieldMetadataMock({ + id: 'd1d3f9eb-1447-4adb-bc2b-f133bc58ac35', + standardId: 'c500fbc0-d6f2-4982-a959-5a755431696c', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.RELATION, + name: 'company', + label: 'Company', + defaultValue: null, + description: 'NoteTarget company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'companyId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '56b9dc8a-0379-42cf-ab31-8db7061f5a2a', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: 'c500fbc0-d6f2-4982-a959-5a755431696c', + flatRelationTargetFieldMetadata: { + id: '56b9dc8a-0379-42cf-ab31-8db7061f5a2a', + standardId: '20202020-bae0-4556-a74a-a9c686f77a88', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'noteTargets', + label: 'Notes', + defaultValue: null, + description: 'Notes tied to the company', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'd1d3f9eb-1447-4adb-bc2b-f133bc58ac35', + relationTargetObjectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + uniqueIdentifier: '20202020-bae0-4556-a74a-a9c686f77a88', + }, + }), + opportunity: getFlatFieldMetadataMock({ + id: 'f42eac2a-8d99-4259-b69a-549abd553eda', + standardId: '20202020-4e42-417a-a705-76581c9ade79', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.RELATION, + name: 'opportunity', + label: 'Opportunity', + defaultValue: null, + description: 'NoteTarget opportunity', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'opportunityId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '36210a54-a72e-4530-a1eb-a0420c53e551', + relationTargetObjectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + uniqueIdentifier: '20202020-4e42-417a-a705-76581c9ade79', + flatRelationTargetFieldMetadata: { + id: '36210a54-a72e-4530-a1eb-a0420c53e551', + standardId: '20202020-dd3f-42d5-a382-db58aabf43d3', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.RELATION, + name: 'noteTargets', + label: 'Notes', + defaultValue: null, + description: 'Notes tied to the opportunity', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'f42eac2a-8d99-4259-b69a-549abd553eda', + relationTargetObjectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + uniqueIdentifier: '20202020-dd3f-42d5-a382-db58aabf43d3', + }, + }), + rocket: getFlatFieldMetadataMock({ + id: '4212b3d7-dd9f-4da9-85f7-2fa69a42296f', + standardId: '20202020-52b6-4d5e-8f21-ed8b7c09c4a9', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.RELATION, + name: 'rocket', + label: 'Rocket', + defaultValue: null, + description: 'NoteTargets Rocket', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'rocketId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'c91376fb-20bd-47c7-8922-b64f7db51cfa', + relationTargetObjectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + uniqueIdentifier: '20202020-52b6-4d5e-8f21-ed8b7c09c4a9', + flatRelationTargetFieldMetadata: { + id: 'c91376fb-20bd-47c7-8922-b64f7db51cfa', + standardId: '20202020-01fd-4f37-99dc-9427a444018a', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.RELATION, + name: 'noteTargets', + label: 'NoteTargets', + defaultValue: null, + description: 'NoteTargets tied to the Rocket', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '4212b3d7-dd9f-4da9-85f7-2fa69a42296f', + relationTargetObjectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + uniqueIdentifier: '20202020-01fd-4f37-99dc-9427a444018a', + }, + }), + pet: getFlatFieldMetadataMock({ + id: 'd88d0737-e83a-47b1-b701-8edfe4a2ae2e', + standardId: '20202020-c54e-4804-8b0d-8795e5166432', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.RELATION, + name: 'pet', + label: 'Pet', + defaultValue: null, + description: 'NoteTargets Pet', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'petId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '98afd46e-0259-4c87-969d-16e7e660e007', + relationTargetObjectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + uniqueIdentifier: '20202020-c54e-4804-8b0d-8795e5166432', + flatRelationTargetFieldMetadata: { + id: '98afd46e-0259-4c87-969d-16e7e660e007', + standardId: '20202020-01fd-4f37-99dc-9427a444018a', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.RELATION, + name: 'noteTargets', + label: 'NoteTargets', + defaultValue: null, + description: 'NoteTargets tied to the Pet', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'd88d0737-e83a-47b1-b701-8edfe4a2ae2e', + relationTargetObjectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + uniqueIdentifier: '20202020-01fd-4f37-99dc-9427a444018a', + }, + }), + surveyResult: getFlatFieldMetadataMock({ + id: '7f444190-cb0e-4417-9c61-e59d8969b7f7', + standardId: '20202020-75c4-4165-8146-dfdc2a76b940', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.RELATION, + name: 'surveyResult', + label: 'Survey result', + defaultValue: null, + description: 'NoteTargets Survey result', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'surveyResultId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '1135971a-b1fa-4e63-b480-69410c6a09cd', + relationTargetObjectMetadataId: '713da753-0340-49b5-b1fa-add34d2dc9a8', + uniqueIdentifier: '20202020-75c4-4165-8146-dfdc2a76b940', + flatRelationTargetFieldMetadata: { + id: '1135971a-b1fa-4e63-b480-69410c6a09cd', + standardId: '20202020-01fd-4f37-99dc-9427a444018a', + objectMetadataId: '713da753-0340-49b5-b1fa-add34d2dc9a8', + type: FieldMetadataType.RELATION, + name: 'noteTargets', + label: 'NoteTargets', + defaultValue: null, + description: 'NoteTargets tied to the Survey result', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '7f444190-cb0e-4417-9c61-e59d8969b7f7', + relationTargetObjectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + uniqueIdentifier: '20202020-01fd-4f37-99dc-9427a444018a', + }, + }), +} as const satisfies Record; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/opportunity-flat-fields.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/opportunity-flat-fields.mock.ts new file mode 100644 index 0000000000..4e51f6c1f4 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/opportunity-flat-fields.mock.ts @@ -0,0 +1,691 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + +import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface'; +import { DateDisplayFormat } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-settings.interface'; + +import { getFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-flat-field-metadata.mock'; +import { RelationOnDeleteAction } from 'src/engine/metadata-modules/relation-metadata/relation-on-delete-action.type'; +import { FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; + +export const OPPORTUNITY_FLAT_FIELDS_MOCK = { + name: getFlatFieldMetadataMock({ + id: '5f510348-58e9-4ded-8dbe-144ae3644bd4', + standardId: '20202020-8609-4f65-a2d9-44009eb422b5', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.TEXT, + name: 'name', + label: 'Name', + defaultValue: "''", + description: 'The opportunity name', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-8609-4f65-a2d9-44009eb422b5', + flatRelationTargetFieldMetadata: null, + }), + amount: getFlatFieldMetadataMock({ + id: '2713c658-cfad-4bc2-a6a0-adc4815185a1', + standardId: '20202020-583e-4642-8533-db761d5fa82f', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.CURRENCY, + name: 'amount', + label: 'Amount', + defaultValue: { amountMicros: null, currencyCode: "''" }, + description: 'Opportunity amount', + icon: 'IconCurrencyDollar', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-583e-4642-8533-db761d5fa82f', + flatRelationTargetFieldMetadata: null, + }), + closeDate: getFlatFieldMetadataMock({ + id: '1d15aa71-38ea-473f-aac9-e4519882213f', + standardId: '20202020-527e-44d6-b1ac-c4158d307b97', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.DATE_TIME, + name: 'closeDate', + label: 'Close date', + defaultValue: null, + description: 'Opportunity close date', + icon: 'IconCalendarEvent', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-527e-44d6-b1ac-c4158d307b97', + flatRelationTargetFieldMetadata: null, + }), + stage: getFlatFieldMetadataMock({ + id: '4642f809-f302-4525-8af1-3f3ad79998fb', + standardId: '20202020-6f76-477d-8551-28cd65b2b4b9', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.SELECT, + name: 'stage', + label: 'Stage', + defaultValue: "'NEW'", + description: 'Opportunity stage', + icon: 'IconProgressCheck', + standardOverrides: null, + options: [ + { + id: 'fdf5cede-2b0e-44d0-adbe-3bc7e613efc9', + color: 'red', + label: 'New', + value: 'NEW', + position: 0, + }, + { + id: '2bf892e2-79ad-4182-84a2-54f797ec8b95', + color: 'purple', + label: 'Screening', + value: 'SCREENING', + position: 1, + }, + { + id: 'fa1c0aee-d400-4352-93c6-077a4fc6ff96', + color: 'sky', + label: 'Meeting', + value: 'MEETING', + position: 2, + }, + { + id: '2aaf3721-6ea7-4596-8b3f-2d09a09f8a8e', + color: 'turquoise', + label: 'Proposal', + value: 'PROPOSAL', + position: 3, + }, + { + id: '24da0470-c4c0-4a3f-86d7-1629d850663e', + color: 'yellow', + label: 'Customer', + value: 'CUSTOMER', + position: 4, + }, + ], + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-6f76-477d-8551-28cd65b2b4b9', + flatRelationTargetFieldMetadata: null, + }), + position: getFlatFieldMetadataMock({ + id: 'd4ca6cb7-fbdb-4e27-b5be-ac9f3a17cf0a', + standardId: '20202020-806d-493a-bbc6-6313e62958e2', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + defaultValue: 0, + description: 'Opportunity record position', + icon: 'IconHierarchy2', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-806d-493a-bbc6-6313e62958e2', + flatRelationTargetFieldMetadata: null, + }), + createdBy: getFlatFieldMetadataMock({ + id: '29222276-99f1-4443-b5d6-6ea6aa16f28a', + standardId: '20202020-a63e-4a62-8e63-42a51828f831', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + defaultValue: { + name: "'System'", + source: "'MANUAL'", + workspaceMemberId: null, + }, + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-a63e-4a62-8e63-42a51828f831', + flatRelationTargetFieldMetadata: null, + }), + searchVector: getFlatFieldMetadataMock({ + id: '0ba0c3f0-41f1-4c49-b28b-0a04adddbc7c', + standardId: '428a0da5-4b2e-4ce3-b695-89a8b384e6e3', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + defaultValue: null, + description: 'Field used for full-text search', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '428a0da5-4b2e-4ce3-b695-89a8b384e6e3', + flatRelationTargetFieldMetadata: null, + }), + id: getFlatFieldMetadataMock({ + id: '06f91646-dd7c-481d-b2d9-6dc02b9b6ca8', + standardId: '20202020-eda0-4cee-9577-3eb357e3c22b', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.UUID, + name: 'id', + label: 'Id', + defaultValue: 'uuid', + description: 'Id', + icon: 'Icon123', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-eda0-4cee-9577-3eb357e3c22b', + flatRelationTargetFieldMetadata: null, + }), + createdAt: getFlatFieldMetadataMock({ + id: '9cc5c7c6-d9eb-46aa-b4a9-e5a922749b14', + standardId: '20202020-66ac-4502-9975-e4d959c50311', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.DATE_TIME, + name: 'createdAt', + label: 'Creation date', + defaultValue: 'now', + description: 'Creation date', + icon: 'IconCalendar', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-66ac-4502-9975-e4d959c50311', + flatRelationTargetFieldMetadata: null, + }), + updatedAt: getFlatFieldMetadataMock({ + id: '04629f30-4fdc-4084-bf3f-7f254acc6cf8', + standardId: '20202020-d767-4622-bdcf-d8a084834d86', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.DATE_TIME, + name: 'updatedAt', + label: 'Last update', + defaultValue: 'now', + description: 'Last time the record was changed', + icon: 'IconCalendarClock', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-d767-4622-bdcf-d8a084834d86', + flatRelationTargetFieldMetadata: null, + }), + deletedAt: getFlatFieldMetadataMock({ + id: '07435758-30b2-4d10-a2c3-947b8db7797f', + standardId: '20202020-b9a7-48d8-8387-b9a3090a50ec', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.DATE_TIME, + name: 'deletedAt', + label: 'Deleted at', + defaultValue: null, + description: 'Date when the record was deleted', + icon: 'IconCalendarMinus', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b9a7-48d8-8387-b9a3090a50ec', + flatRelationTargetFieldMetadata: null, + }), + pointOfContact: getFlatFieldMetadataMock({ + id: '0e55bf63-1ffb-4f74-89f2-edd5a6a6686c', + standardId: '20202020-8dfb-42fc-92b6-01afb759ed16', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.RELATION, + name: 'pointOfContact', + label: 'Point of Contact', + defaultValue: null, + description: 'Opportunity point of contact', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'pointOfContactId', + }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '7580c1b1-e8f9-480b-bd41-38b20df35777', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-8dfb-42fc-92b6-01afb759ed16', + flatRelationTargetFieldMetadata: { + id: '7580c1b1-e8f9-480b-bd41-38b20df35777', + standardId: '20202020-911b-4a7d-b67b-918aa9a5b33a', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'pointOfContactForOpportunities', + label: 'Opportunities', + defaultValue: null, + description: + 'List of opportunities for which that person is the point of contact', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '0e55bf63-1ffb-4f74-89f2-edd5a6a6686c', + relationTargetObjectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + uniqueIdentifier: '20202020-911b-4a7d-b67b-918aa9a5b33a', + }, + }), + company: getFlatFieldMetadataMock({ + id: '512890f1-4da0-4b96-bb71-5ccabefb82e7', + standardId: '20202020-cbac-457e-b565-adece5fc815f', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.RELATION, + name: 'company', + label: 'Company', + defaultValue: null, + description: 'Opportunity company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'companyId', + }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '3eda8c8e-74e4-401f-bb0e-470db5b267e6', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: '20202020-cbac-457e-b565-adece5fc815f', + flatRelationTargetFieldMetadata: { + id: '3eda8c8e-74e4-401f-bb0e-470db5b267e6', + standardId: '20202020-add3-4658-8e23-d70dccb6d0ec', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'opportunities', + label: 'Opportunities', + defaultValue: null, + description: 'Opportunities linked to the company.', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '512890f1-4da0-4b96-bb71-5ccabefb82e7', + relationTargetObjectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + uniqueIdentifier: '20202020-add3-4658-8e23-d70dccb6d0ec', + }, + }), + favorites: getFlatFieldMetadataMock({ + id: '87bb9924-a1cc-4357-9c8a-52141dabf266', + standardId: '20202020-a1c2-4500-aaae-83ba8a0e827a', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.RELATION, + name: 'favorites', + label: 'Favorites', + defaultValue: null, + description: 'Favorites linked to the opportunity', + icon: 'IconHeart', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '6380cf8e-4327-4d1e-ad21-1826ce4ecf05', + relationTargetObjectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + uniqueIdentifier: '20202020-a1c2-4500-aaae-83ba8a0e827a', + flatRelationTargetFieldMetadata: { + id: '6380cf8e-4327-4d1e-ad21-1826ce4ecf05', + standardId: '20202020-dabc-48e1-8318-2781a2b32aa2', + objectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + type: FieldMetadataType.RELATION, + name: 'opportunity', + label: 'Opportunity', + defaultValue: null, + description: 'Favorite opportunity', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'opportunityId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '87bb9924-a1cc-4357-9c8a-52141dabf266', + relationTargetObjectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + uniqueIdentifier: '20202020-dabc-48e1-8318-2781a2b32aa2', + }, + }), + taskTargets: getFlatFieldMetadataMock({ + id: 'c0c9f9ac-0d40-4206-90e5-0d1e14f8a09f', + standardId: '20202020-59c0-4179-a208-4a255f04a5be', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.RELATION, + name: 'taskTargets', + label: 'Tasks', + defaultValue: null, + description: 'Tasks tied to the opportunity', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '49afc8d8-dde3-4d19-aa6b-bd16a751b114', + relationTargetObjectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + uniqueIdentifier: '20202020-59c0-4179-a208-4a255f04a5be', + flatRelationTargetFieldMetadata: { + id: '49afc8d8-dde3-4d19-aa6b-bd16a751b114', + standardId: '20202020-6cb2-4c01-a9a5-aca3dbc11d41', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.RELATION, + name: 'opportunity', + label: 'Opportunity', + defaultValue: null, + description: 'TaskTarget opportunity', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'opportunityId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'c0c9f9ac-0d40-4206-90e5-0d1e14f8a09f', + relationTargetObjectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + uniqueIdentifier: '20202020-6cb2-4c01-a9a5-aca3dbc11d41', + }, + }), + noteTargets: getFlatFieldMetadataMock({ + id: '36210a54-a72e-4530-a1eb-a0420c53e551', + standardId: '20202020-dd3f-42d5-a382-db58aabf43d3', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.RELATION, + name: 'noteTargets', + label: 'Notes', + defaultValue: null, + description: 'Notes tied to the opportunity', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'f42eac2a-8d99-4259-b69a-549abd553eda', + relationTargetObjectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + uniqueIdentifier: '20202020-dd3f-42d5-a382-db58aabf43d3', + flatRelationTargetFieldMetadata: { + id: 'f42eac2a-8d99-4259-b69a-549abd553eda', + standardId: '20202020-4e42-417a-a705-76581c9ade79', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.RELATION, + name: 'opportunity', + label: 'Opportunity', + defaultValue: null, + description: 'NoteTarget opportunity', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'opportunityId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '36210a54-a72e-4530-a1eb-a0420c53e551', + relationTargetObjectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + uniqueIdentifier: '20202020-4e42-417a-a705-76581c9ade79', + }, + }), + attachments: getFlatFieldMetadataMock({ + id: '16515578-a6ce-48af-a303-2005bb8492f0', + standardId: '20202020-87c7-4118-83d6-2f4031005209', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Attachments linked to the opportunity', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'da72fbe2-a5aa-42b5-b6bd-482a3919eb20', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-87c7-4118-83d6-2f4031005209', + flatRelationTargetFieldMetadata: { + id: 'da72fbe2-a5aa-42b5-b6bd-482a3919eb20', + standardId: '20202020-7374-499d-bea3-9354890755b5', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'opportunity', + label: 'Opportunity', + defaultValue: null, + description: 'Attachment opportunity', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'opportunityId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '16515578-a6ce-48af-a303-2005bb8492f0', + relationTargetObjectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + uniqueIdentifier: '20202020-7374-499d-bea3-9354890755b5', + }, + }), + timelineActivities: getFlatFieldMetadataMock({ + id: '7826944b-3b21-4448-892e-5a2a68161313', + standardId: '20202020-30e2-421f-96c7-19c69d1cf631', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Timeline Activities', + defaultValue: null, + description: 'Timeline Activities linked to the opportunity.', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '026cbaa7-860c-4ed4-b878-8d78849e6c28', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-30e2-421f-96c7-19c69d1cf631', + flatRelationTargetFieldMetadata: { + id: '026cbaa7-860c-4ed4-b878-8d78849e6c28', + standardId: '20202020-7664-4a35-a3df-580d389fd527', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'opportunity', + label: 'Opportunity', + defaultValue: null, + description: 'Event opportunity', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'opportunityId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '7826944b-3b21-4448-892e-5a2a68161313', + relationTargetObjectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + uniqueIdentifier: '20202020-7664-4a35-a3df-580d389fd527', + }, + }), +} as const satisfies Record; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/person-flat-fields.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/person-flat-fields.mock.ts new file mode 100644 index 0000000000..afe1f91ed8 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/person-flat-fields.mock.ts @@ -0,0 +1,1030 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + +import { DateDisplayFormat } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-settings.interface'; +import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface'; + +import { getFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-flat-field-metadata.mock'; +import { FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; +import { RelationOnDeleteAction } from 'src/engine/metadata-modules/relation-metadata/relation-on-delete-action.type'; + +export const PERSON_FLAT_FIELDS_MOCK = { + name: getFlatFieldMetadataMock({ + id: 'f410c1cd-2523-4802-be8e-1acc852b4b1a', + standardId: '20202020-3875-44d5-8c33-a6239011cab8', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.FULL_NAME, + name: 'name', + label: 'Name', + defaultValue: { lastName: "''", firstName: "''" }, + description: 'Contact’s name', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-3875-44d5-8c33-a6239011cab8', + flatRelationTargetFieldMetadata: null, + }), + emails: getFlatFieldMetadataMock({ + id: '012dd567-b7d9-4088-a0c1-4ded96a25e35', + standardId: '20202020-3c51-43fa-8b6e-af39e29368ab', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.EMAILS, + name: 'emails', + label: 'Emails', + defaultValue: { primaryEmail: "''", additionalEmails: null }, + description: 'Contact’s Emails', + icon: 'IconMail', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: true, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-3c51-43fa-8b6e-af39e29368ab', + flatRelationTargetFieldMetadata: null, + }), + linkedinLink: getFlatFieldMetadataMock({ + id: '86e35da6-151d-47e3-8745-bb1e652b789c', + standardId: '20202020-f1af-48f7-893b-2007a73dd508', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.LINKS, + name: 'linkedinLink', + label: 'Linkedin', + defaultValue: { + primaryLinkUrl: "''", + secondaryLinks: [], + primaryLinkLabel: "''", + }, + description: 'Contact’s Linkedin account', + icon: 'IconBrandLinkedin', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-f1af-48f7-893b-2007a73dd508', + flatRelationTargetFieldMetadata: null, + }), + xLink: getFlatFieldMetadataMock({ + id: 'c9d36790-a449-4108-91e1-c6ad6e3379fb', + standardId: '20202020-8fc2-487c-b84a-55a99b145cfd', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.LINKS, + name: 'xLink', + label: 'X', + defaultValue: { + primaryLinkUrl: "''", + secondaryLinks: [], + primaryLinkLabel: "''", + }, + description: 'Contact’s X/Twitter account', + icon: 'IconBrandX', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-8fc2-487c-b84a-55a99b145cfd', + flatRelationTargetFieldMetadata: null, + }), + jobTitle: getFlatFieldMetadataMock({ + id: 'ab82c659-b553-4317-9708-998f6884c72e', + standardId: '20202020-b0d0-415a-bef9-640a26dacd9b', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.TEXT, + name: 'jobTitle', + label: 'Job Title', + defaultValue: "''", + description: 'Contact’s job title', + icon: 'IconBriefcase', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b0d0-415a-bef9-640a26dacd9b', + flatRelationTargetFieldMetadata: null, + }), + phones: getFlatFieldMetadataMock({ + id: '4955e9cb-a740-49fa-9c91-69ec74a6b3df', + standardId: '20202020-0638-448e-8825-439134618022', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.PHONES, + name: 'phones', + label: 'Phones', + defaultValue: { + additionalPhones: null, + primaryPhoneNumber: "''", + primaryPhoneCallingCode: "''", + primaryPhoneCountryCode: "''", + }, + description: 'Contact’s phone numbers', + icon: 'IconPhone', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-0638-448e-8825-439134618022', + flatRelationTargetFieldMetadata: null, + }), + city: getFlatFieldMetadataMock({ + id: '61ad7592-6465-4a24-a863-0320cf7830a6', + standardId: '20202020-5243-4ffb-afc5-2c675da41346', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.TEXT, + name: 'city', + label: 'City', + defaultValue: "''", + description: 'Contact’s city', + icon: 'IconMap', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-5243-4ffb-afc5-2c675da41346', + flatRelationTargetFieldMetadata: null, + }), + avatarUrl: getFlatFieldMetadataMock({ + id: '05e46775-93e9-46c4-8b6f-94829045b1ad', + standardId: '20202020-b8a6-40df-961c-373dc5d2ec21', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.TEXT, + name: 'avatarUrl', + label: 'Avatar', + defaultValue: "''", + description: 'Contact’s avatar', + icon: 'IconFileUpload', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b8a6-40df-961c-373dc5d2ec21', + flatRelationTargetFieldMetadata: null, + }), + position: getFlatFieldMetadataMock({ + id: '5162d850-29dd-474e-982b-24257b57fd46', + standardId: '20202020-fcd5-4231-aff5-fff583eaa0b1', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + defaultValue: 0, + description: 'Person record Position', + icon: 'IconHierarchy2', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-fcd5-4231-aff5-fff583eaa0b1', + flatRelationTargetFieldMetadata: null, + }), + createdBy: getFlatFieldMetadataMock({ + id: '1a3de345-4f47-4dc9-b328-61c802efa36e', + standardId: '20202020-f6ab-4d98-af24-a3d5b664148a', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + defaultValue: { + name: "'System'", + source: "'MANUAL'", + workspaceMemberId: null, + }, + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-f6ab-4d98-af24-a3d5b664148a', + flatRelationTargetFieldMetadata: null, + }), + searchVector: getFlatFieldMetadataMock({ + id: '1d7f79d4-7811-45dc-8f9f-5dbd4863d0a1', + standardId: '57d1d7ad-fa10-44fc-82f3-ad0959ec2534', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + defaultValue: null, + description: 'Field used for full-text search', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '57d1d7ad-fa10-44fc-82f3-ad0959ec2534', + flatRelationTargetFieldMetadata: null, + }), + id: getFlatFieldMetadataMock({ + id: 'd9b3e129-49ce-4843-a813-9d16f2239472', + standardId: '20202020-eda0-4cee-9577-3eb357e3c22b', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.UUID, + name: 'id', + label: 'Id', + defaultValue: 'uuid', + description: 'Id', + icon: 'Icon123', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-eda0-4cee-9577-3eb357e3c22b', + flatRelationTargetFieldMetadata: null, + }), + createdAt: getFlatFieldMetadataMock({ + id: '9fec2460-6fd2-4aaf-8781-78893ba61d6d', + standardId: '20202020-66ac-4502-9975-e4d959c50311', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.DATE_TIME, + name: 'createdAt', + label: 'Creation date', + defaultValue: 'now', + description: 'Creation date', + icon: 'IconCalendar', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-66ac-4502-9975-e4d959c50311', + flatRelationTargetFieldMetadata: null, + }), + updatedAt: getFlatFieldMetadataMock({ + id: '6a00c4b7-d77c-4268-85e7-9e3a597bd0e7', + standardId: '20202020-d767-4622-bdcf-d8a084834d86', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.DATE_TIME, + name: 'updatedAt', + label: 'Last update', + defaultValue: 'now', + description: 'Last time the record was changed', + icon: 'IconCalendarClock', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-d767-4622-bdcf-d8a084834d86', + flatRelationTargetFieldMetadata: null, + }), + deletedAt: getFlatFieldMetadataMock({ + id: 'a9f5469d-d7ff-42f6-b3a7-399c8ab8b468', + standardId: '20202020-b9a7-48d8-8387-b9a3090a50ec', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.DATE_TIME, + name: 'deletedAt', + label: 'Deleted at', + defaultValue: null, + description: 'Date when the record was deleted', + icon: 'IconCalendarMinus', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b9a7-48d8-8387-b9a3090a50ec', + flatRelationTargetFieldMetadata: null, + }), + company: getFlatFieldMetadataMock({ + id: 'ee247ca6-fdaa-4a56-87a2-730cf84f5f29', + standardId: '20202020-e2f3-448e-b34c-2d625f0025fd', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'company', + label: 'Company', + defaultValue: null, + description: 'Contact’s company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'companyId', + }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'b0563539-f027-40c5-a14c-ee7a25ff6fd9', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: '20202020-e2f3-448e-b34c-2d625f0025fd', + flatRelationTargetFieldMetadata: { + id: 'b0563539-f027-40c5-a14c-ee7a25ff6fd9', + standardId: '20202020-3213-4ddf-9494-6422bcff8d7c', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'people', + label: 'People', + defaultValue: null, + description: 'People linked to the company.', + icon: 'IconUsers', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'ee247ca6-fdaa-4a56-87a2-730cf84f5f29', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-3213-4ddf-9494-6422bcff8d7c', + }, + }), + pointOfContactForOpportunities: getFlatFieldMetadataMock({ + id: '7580c1b1-e8f9-480b-bd41-38b20df35777', + standardId: '20202020-911b-4a7d-b67b-918aa9a5b33a', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'pointOfContactForOpportunities', + label: 'Opportunities', + defaultValue: null, + description: + 'List of opportunities for which that person is the point of contact', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '0e55bf63-1ffb-4f74-89f2-edd5a6a6686c', + relationTargetObjectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + uniqueIdentifier: '20202020-911b-4a7d-b67b-918aa9a5b33a', + flatRelationTargetFieldMetadata: { + id: '0e55bf63-1ffb-4f74-89f2-edd5a6a6686c', + standardId: '20202020-8dfb-42fc-92b6-01afb759ed16', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.RELATION, + name: 'pointOfContact', + label: 'Point of Contact', + defaultValue: null, + description: 'Opportunity point of contact', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'pointOfContactId', + }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '7580c1b1-e8f9-480b-bd41-38b20df35777', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-8dfb-42fc-92b6-01afb759ed16', + }, + }), + taskTargets: getFlatFieldMetadataMock({ + id: '9609ca31-215e-47fd-9b3b-ab200acb2fa8', + standardId: '20202020-584b-4d3e-88b6-53ab1fa03c3a', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'taskTargets', + label: 'Tasks', + defaultValue: null, + description: 'Tasks tied to the contact', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '64225f87-96c4-4846-9462-e7aa3ad9e182', + relationTargetObjectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + uniqueIdentifier: '20202020-584b-4d3e-88b6-53ab1fa03c3a', + flatRelationTargetFieldMetadata: { + id: '64225f87-96c4-4846-9462-e7aa3ad9e182', + standardId: '20202020-c8a0-4e85-a016-87e2349cfbec', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.RELATION, + name: 'person', + label: 'Person', + defaultValue: null, + description: 'TaskTarget person', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'personId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '9609ca31-215e-47fd-9b3b-ab200acb2fa8', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-c8a0-4e85-a016-87e2349cfbec', + }, + }), + noteTargets: getFlatFieldMetadataMock({ + id: '60388ed8-45f6-4fb5-8752-81c73e13f4ab', + standardId: '20202020-c8fc-4258-8250-15905d3fcfec', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'noteTargets', + label: 'Notes', + defaultValue: null, + description: 'Notes tied to the contact', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '560c71ff-254f-4baf-a4d1-054c53444f41', + relationTargetObjectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + uniqueIdentifier: '20202020-c8fc-4258-8250-15905d3fcfec', + flatRelationTargetFieldMetadata: { + id: '560c71ff-254f-4baf-a4d1-054c53444f41', + standardId: '20202020-38ca-4aab-92f5-8a605ca2e4c5', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.RELATION, + name: 'person', + label: 'Person', + defaultValue: null, + description: 'NoteTarget person', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'personId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '60388ed8-45f6-4fb5-8752-81c73e13f4ab', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-38ca-4aab-92f5-8a605ca2e4c5', + }, + }), + favorites: getFlatFieldMetadataMock({ + id: 'a1a72bee-1c15-4598-ba23-67ba8e3e505d', + standardId: '20202020-4073-4117-9cf1-203bcdc91cbd', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'favorites', + label: 'Favorites', + defaultValue: null, + description: 'Favorites linked to the contact', + icon: 'IconHeart', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '013cec20-e9cc-42db-b9b9-ff6bd0f52abd', + relationTargetObjectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + uniqueIdentifier: '20202020-4073-4117-9cf1-203bcdc91cbd', + flatRelationTargetFieldMetadata: { + id: '013cec20-e9cc-42db-b9b9-ff6bd0f52abd', + standardId: '20202020-c428-4f40-b6f3-86091511c41c', + objectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + type: FieldMetadataType.RELATION, + name: 'person', + label: 'Person', + defaultValue: null, + description: 'Favorite person', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'personId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'a1a72bee-1c15-4598-ba23-67ba8e3e505d', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-c428-4f40-b6f3-86091511c41c', + }, + }), + attachments: getFlatFieldMetadataMock({ + id: '367ad117-de09-466c-94f8-ce99d951b5ce', + standardId: '20202020-cd97-451f-87fa-bcb789bdbf3a', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Attachments linked to the contact.', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '6938c2ec-ebcc-4f30-8d38-2c9c40228c53', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-cd97-451f-87fa-bcb789bdbf3a', + flatRelationTargetFieldMetadata: { + id: '6938c2ec-ebcc-4f30-8d38-2c9c40228c53', + standardId: '20202020-0158-4aa2-965c-5cdafe21ffa2', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'person', + label: 'Person', + defaultValue: null, + description: 'Attachment person', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'personId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '367ad117-de09-466c-94f8-ce99d951b5ce', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-0158-4aa2-965c-5cdafe21ffa2', + }, + }), + messageParticipants: getFlatFieldMetadataMock({ + id: '22dcab3c-939c-4b8d-bd7c-4c4d58588460', + standardId: '20202020-498e-4c61-8158-fa04f0638334', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'messageParticipants', + label: 'Message Participants', + defaultValue: null, + description: 'Message Participants', + icon: 'IconUserCircle', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'e95d7d1a-9101-4048-b019-d2f8bc110328', + relationTargetObjectMetadataId: 'edb170fd-a0c2-4619-b1a9-293cf07437c4', + uniqueIdentifier: '20202020-498e-4c61-8158-fa04f0638334', + flatRelationTargetFieldMetadata: { + id: 'e95d7d1a-9101-4048-b019-d2f8bc110328', + standardId: '20202020-249d-4e0f-82cd-1b9df5cd3da2', + objectMetadataId: 'edb170fd-a0c2-4619-b1a9-293cf07437c4', + type: FieldMetadataType.RELATION, + name: 'person', + label: 'Person', + defaultValue: null, + description: 'Person', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'personId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '22dcab3c-939c-4b8d-bd7c-4c4d58588460', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-249d-4e0f-82cd-1b9df5cd3da2', + }, + }), + calendarEventParticipants: getFlatFieldMetadataMock({ + id: '9e82a873-2988-4d9d-af04-81f2d947f4ec', + standardId: '20202020-52ee-45e9-a702-b64b3753e3a9', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'calendarEventParticipants', + label: 'Calendar Event Participants', + defaultValue: null, + description: 'Calendar Event Participants', + icon: 'IconCalendar', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'e39f443d-3282-47a3-a24d-47ed604d58be', + relationTargetObjectMetadataId: 'a4c662b6-e08d-40a5-ae55-82ed8f4edf78', + uniqueIdentifier: '20202020-52ee-45e9-a702-b64b3753e3a9', + flatRelationTargetFieldMetadata: { + id: 'e39f443d-3282-47a3-a24d-47ed604d58be', + standardId: '20202020-5761-4842-8186-e1898ef93966', + objectMetadataId: 'a4c662b6-e08d-40a5-ae55-82ed8f4edf78', + type: FieldMetadataType.RELATION, + name: 'person', + label: 'Person', + defaultValue: null, + description: 'Person', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'personId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '9e82a873-2988-4d9d-af04-81f2d947f4ec', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-5761-4842-8186-e1898ef93966', + }, + }), + timelineActivities: getFlatFieldMetadataMock({ + id: 'b1457347-545b-4a42-9c68-bc655952229a', + standardId: '20202020-a43e-4873-9c23-e522de906ce5', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Events', + defaultValue: null, + description: 'Events linked to the person', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'dbd02754-4bef-4149-b39d-54759983ab47', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-a43e-4873-9c23-e522de906ce5', + flatRelationTargetFieldMetadata: { + id: 'dbd02754-4bef-4149-b39d-54759983ab47', + standardId: '20202020-c414-45b9-a60a-ac27aa96229f', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'person', + label: 'Person', + defaultValue: null, + description: 'Event person', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'personId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'b1457347-545b-4a42-9c68-bc655952229a', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-c414-45b9-a60a-ac27aa96229f', + }, + }), + intro: getFlatFieldMetadataMock({ + id: '94c95bfa-88bc-4271-87c2-08e6df084a15', + standardId: null, + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.TEXT, + name: 'intro', + label: 'Intro', + defaultValue: "''", + description: null, + icon: 'IconNote', + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '94c95bfa-88bc-4271-87c2-08e6df084a15', + flatRelationTargetFieldMetadata: null, + }), + whatsapp: getFlatFieldMetadataMock({ + id: 'adc26aa8-d146-49d2-a037-77e15d8b20fc', + standardId: null, + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.PHONES, + name: 'whatsapp', + label: 'Whatsapp', + defaultValue: { + additionalPhones: null, + primaryPhoneNumber: "''", + primaryPhoneCallingCode: "'+33'", + primaryPhoneCountryCode: "'FR'", + }, + description: null, + icon: 'IconBrandWhatsapp', + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: 'adc26aa8-d146-49d2-a037-77e15d8b20fc', + flatRelationTargetFieldMetadata: null, + }), + workPreference: getFlatFieldMetadataMock({ + id: '421b5788-94dd-40b0-8d5f-6c649d7464c4', + standardId: null, + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.MULTI_SELECT, + name: 'workPreference', + label: 'Work Preference', + defaultValue: null, + description: null, + icon: 'IconHome', + standardOverrides: null, + options: [ + { + id: 'c33d02fd-0bd9-4769-bd32-036d9ff645a5', + color: 'green', + label: 'On-Site', + value: 'ON_SITE', + position: 0, + }, + { + id: '98d938d8-9439-4483-9944-ec073c9a3986', + color: 'turquoise', + label: 'Hybrid', + value: 'HYBRID', + position: 1, + }, + { + id: '661f6ba8-7340-4830-ab0c-b6d8ed658ade', + color: 'sky', + label: 'Remote Work', + value: 'REMOTE_WORK', + position: 2, + }, + ], + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '421b5788-94dd-40b0-8d5f-6c649d7464c4', + flatRelationTargetFieldMetadata: null, + }), + performanceRating: getFlatFieldMetadataMock({ + id: 'f75b0e71-e34c-4bc9-bb91-55a94127ab82', + standardId: null, + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RATING, + name: 'performanceRating', + label: 'Performance Rating', + defaultValue: null, + description: null, + icon: 'IconStars', + standardOverrides: null, + options: [ + { + id: 'e6b4b1bb-c707-41cb-8f30-418a81ae3299', + label: '1', + value: 'RATING_1', + position: 0, + }, + { + id: '5eaa1985-6970-4add-ab73-9e7a590f7a27', + label: '2', + value: 'RATING_2', + position: 1, + }, + { + id: '6b61794f-42d5-4a3a-8cb3-f911aac15803', + label: '3', + value: 'RATING_3', + position: 2, + }, + { + id: '3ed5ba36-8c24-400b-b58a-d2ee306bb46f', + label: '4', + value: 'RATING_4', + position: 3, + }, + { + id: 'af3beb45-5937-4c4b-8aa4-3cc3f356d131', + label: '5', + value: 'RATING_5', + position: 4, + }, + ], + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: 'f75b0e71-e34c-4bc9-bb91-55a94127ab82', + flatRelationTargetFieldMetadata: null, + }), +} as const satisfies Record; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/pet-flat-fields.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/pet-flat-fields.mock.ts new file mode 100644 index 0000000000..767e454d9d --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/pet-flat-fields.mock.ts @@ -0,0 +1,1005 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + +import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface'; + +import { getFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-flat-field-metadata.mock'; +import { FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; +import { RelationOnDeleteAction } from 'src/engine/metadata-modules/relation-metadata/relation-on-delete-action.type'; + +export const PET_FLAT_FIELDS_MOCK = { + noteTargets: getFlatFieldMetadataMock({ + id: '98afd46e-0259-4c87-969d-16e7e660e007', + standardId: '20202020-01fd-4f37-99dc-9427a444018a', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.RELATION, + name: 'noteTargets', + label: 'NoteTargets', + defaultValue: null, + description: 'NoteTargets tied to the Pet', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'd88d0737-e83a-47b1-b701-8edfe4a2ae2e', + relationTargetObjectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + uniqueIdentifier: '20202020-01fd-4f37-99dc-9427a444018a', + flatRelationTargetFieldMetadata: { + id: 'd88d0737-e83a-47b1-b701-8edfe4a2ae2e', + standardId: '20202020-c54e-4804-8b0d-8795e5166432', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.RELATION, + name: 'pet', + label: 'Pet', + defaultValue: null, + description: 'NoteTargets Pet', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'petId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '98afd46e-0259-4c87-969d-16e7e660e007', + relationTargetObjectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + uniqueIdentifier: '20202020-c54e-4804-8b0d-8795e5166432', + }, + }), + id: getFlatFieldMetadataMock({ + id: 'ce25501a-1cc6-44c5-9158-b602db0efaca', + standardId: '20202020-eda0-4cee-9577-3eb357e3c22b', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.UUID, + name: 'id', + label: 'Id', + defaultValue: 'uuid', + description: 'Id', + icon: 'Icon123', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-eda0-4cee-9577-3eb357e3c22b', + flatRelationTargetFieldMetadata: null, + }), + name: getFlatFieldMetadataMock({ + id: '4311d4e0-ce63-479c-a4da-5b244e2348cc', + standardId: '20202020-ba07-4ffd-ba63-009491f5749c', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.TEXT, + name: 'name', + label: 'Name', + defaultValue: "'Untitled'", + description: 'Name', + icon: 'IconAbc', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-ba07-4ffd-ba63-009491f5749c', + flatRelationTargetFieldMetadata: null, + }), + createdAt: getFlatFieldMetadataMock({ + id: '0bbe259b-0fd1-43ca-922f-1c0b7960efbe', + standardId: '20202020-66ac-4502-9975-e4d959c50311', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.DATE_TIME, + name: 'createdAt', + label: 'Creation date', + defaultValue: 'now', + description: 'Creation date', + icon: 'IconCalendar', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-66ac-4502-9975-e4d959c50311', + flatRelationTargetFieldMetadata: null, + }), + updatedAt: getFlatFieldMetadataMock({ + id: 'c96d123d-4c13-47ee-85bf-00428ce5e242', + standardId: '20202020-d767-4622-bdcf-d8a084834d86', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.DATE_TIME, + name: 'updatedAt', + label: 'Last update', + defaultValue: 'now', + description: 'Last time the record was changed', + icon: 'IconCalendarClock', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-d767-4622-bdcf-d8a084834d86', + flatRelationTargetFieldMetadata: null, + }), + deletedAt: getFlatFieldMetadataMock({ + id: 'bbfd9b09-be13-4232-af2c-585a9137aa62', + standardId: '20202020-b9a7-48d8-8387-b9a3090a50ec', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.DATE_TIME, + name: 'deletedAt', + label: 'Deleted at', + defaultValue: null, + description: 'Deletion date', + icon: 'IconCalendarClock', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b9a7-48d8-8387-b9a3090a50ec', + flatRelationTargetFieldMetadata: null, + }), + createdBy: getFlatFieldMetadataMock({ + id: '2090b892-376c-4349-990d-6a789b53e31d', + standardId: '20202020-be0e-4971-865b-32ca87cbb315', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + defaultValue: { name: "''", source: "'MANUAL'" }, + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-be0e-4971-865b-32ca87cbb315', + flatRelationTargetFieldMetadata: null, + }), + position: getFlatFieldMetadataMock({ + id: '3087f7da-f422-4b69-9b95-fadef79dd12a', + standardId: '20202020-c2bd-4e16-bb9a-c8b0411bf49d', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + defaultValue: 0, + description: 'Position', + icon: 'IconHierarchy2', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-c2bd-4e16-bb9a-c8b0411bf49d', + flatRelationTargetFieldMetadata: null, + }), + timelineActivities: getFlatFieldMetadataMock({ + id: '4eb74f21-1cb4-46b5-b3bb-4e41108e70d9', + standardId: '20202020-f1ef-4ba4-8f33-1a4577afa477', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'TimelineActivities', + defaultValue: null, + description: 'TimelineActivities tied to the Pet', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '3cb86390-4ee7-42fa-bd1e-bd6326b47610', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-f1ef-4ba4-8f33-1a4577afa477', + flatRelationTargetFieldMetadata: { + id: '3cb86390-4ee7-42fa-bd1e-bd6326b47610', + standardId: '20202020-d88f-4020-8c85-d6c600903762', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'pet', + label: 'Pet', + defaultValue: null, + description: 'TimelineActivities Pet', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'petId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '4eb74f21-1cb4-46b5-b3bb-4e41108e70d9', + relationTargetObjectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + uniqueIdentifier: '20202020-d88f-4020-8c85-d6c600903762', + }, + }), + favorites: getFlatFieldMetadataMock({ + id: '80bc4e7a-6bd1-4f2b-98b1-6333c631cc1a', + standardId: '20202020-a4a7-4686-b296-1c6c3482ee21', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.RELATION, + name: 'favorites', + label: 'Favorites', + defaultValue: null, + description: 'Favorites tied to the Pet', + icon: 'IconHeart', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'd34b4048-bf0c-4c61-8ffe-59f1838a2cc4', + relationTargetObjectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + uniqueIdentifier: '20202020-a4a7-4686-b296-1c6c3482ee21', + flatRelationTargetFieldMetadata: { + id: 'd34b4048-bf0c-4c61-8ffe-59f1838a2cc4', + standardId: '20202020-1bd7-4d10-80dc-968b9f5d1a8a', + objectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + type: FieldMetadataType.RELATION, + name: 'pet', + label: 'Pet', + defaultValue: null, + description: 'Favorites Pet', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'petId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '80bc4e7a-6bd1-4f2b-98b1-6333c631cc1a', + relationTargetObjectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + uniqueIdentifier: '20202020-1bd7-4d10-80dc-968b9f5d1a8a', + }, + }), + attachments: getFlatFieldMetadataMock({ + id: '231903d0-3b14-47ed-9a88-fbf11031c451', + standardId: '20202020-8d59-46ca-b7b2-73d167712134', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Attachments tied to the Pet', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '317a33ef-117e-4953-86d4-c4a9670a2ce3', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-8d59-46ca-b7b2-73d167712134', + flatRelationTargetFieldMetadata: { + id: '317a33ef-117e-4953-86d4-c4a9670a2ce3', + standardId: '20202020-b715-4658-8b6a-5359824dbddd', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'pet', + label: 'Pet', + defaultValue: null, + description: 'Attachments Pet', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'petId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '231903d0-3b14-47ed-9a88-fbf11031c451', + relationTargetObjectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + uniqueIdentifier: '20202020-b715-4658-8b6a-5359824dbddd', + }, + }), + taskTargets: getFlatFieldMetadataMock({ + id: '3cae8259-ece8-4b81-9044-f5abae5ff25c', + standardId: '20202020-0860-4566-b865-bff3c626c303', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.RELATION, + name: 'taskTargets', + label: 'TaskTargets', + defaultValue: null, + description: 'TaskTargets tied to the Pet', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '3955a4b4-1c10-4ce8-a92e-98e727ee7aec', + relationTargetObjectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + uniqueIdentifier: '20202020-0860-4566-b865-bff3c626c303', + flatRelationTargetFieldMetadata: { + id: '3955a4b4-1c10-4ce8-a92e-98e727ee7aec', + standardId: '20202020-07d9-4d04-8b73-a39ab65943f1', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.RELATION, + name: 'pet', + label: 'Pet', + defaultValue: null, + description: 'TaskTargets Pet', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'petId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '3cae8259-ece8-4b81-9044-f5abae5ff25c', + relationTargetObjectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + uniqueIdentifier: '20202020-07d9-4d04-8b73-a39ab65943f1', + }, + }), + searchVector: getFlatFieldMetadataMock({ + id: '0db37175-e573-43e4-bd83-fa71923fde0c', + standardId: '70e56537-18ef-4811-b1c7-0a444006b815', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + defaultValue: null, + description: 'Field used for full-text search', + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: false, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '70e56537-18ef-4811-b1c7-0a444006b815', + flatRelationTargetFieldMetadata: null, + }), + species: getFlatFieldMetadataMock({ + id: '0292cc51-246f-40b8-99e8-3345dac0e688', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.SELECT, + name: 'species', + label: 'Species', + defaultValue: null, + description: null, + icon: null, + standardOverrides: null, + options: [ + { + id: '23a75463-ca50-4b33-bfd8-701e2944c76c', + color: 'blue', + label: 'Dog', + value: 'DOG', + position: 0, + }, + { + id: 'e4669573-b219-44e1-a857-ed9fb31c51cd', + color: 'red', + label: 'Cat', + value: 'CAT', + position: 1, + }, + { + id: '26cc93c8-e2ef-452a-80c3-60d274033f38', + color: 'green', + label: 'Bird', + value: 'BIRD', + position: 2, + }, + { + id: '364e1363-166d-4dbd-b39b-c50e658b536c', + color: 'yellow', + label: 'Fish', + value: 'FISH', + position: 3, + }, + { + id: '041726a2-73b8-45de-b311-6deeec79886e', + color: 'purple', + label: 'Rabbit', + value: 'RABBIT', + position: 4, + }, + { + id: '3966dd54-985e-49d9-ab13-aea1346763d4', + color: 'orange', + label: 'Hamster', + value: 'HAMSTER', + position: 5, + }, + ], + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '0292cc51-246f-40b8-99e8-3345dac0e688', + flatRelationTargetFieldMetadata: null, + }), + traits: getFlatFieldMetadataMock({ + id: '5aaf6be0-b9f5-4222-9810-941d5ab58527', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.MULTI_SELECT, + name: 'traits', + label: 'Traits', + defaultValue: null, + description: null, + icon: null, + standardOverrides: null, + options: [ + { + id: '5bb37088-b364-44c5-a984-54b01aa241ce', + color: 'blue', + label: 'Playful', + value: 'PLAYFUL', + position: 0, + }, + { + id: '69d7d78d-3983-4e3b-aec5-6e6daafb06d6', + color: 'red', + label: 'Friendly', + value: 'FRIENDLY', + position: 1, + }, + { + id: 'c5d7fa50-ed21-4373-bcca-ae7006e3a784', + color: 'green', + label: 'Protective', + value: 'PROTECTIVE', + position: 2, + }, + { + id: '85595ae8-5d17-4580-8c99-cd429f509d75', + color: 'yellow', + label: 'Shy', + value: 'SHY', + position: 3, + }, + { + id: '77d4bffb-8da3-4aad-ab08-fa5f0b0ab0f2', + color: 'purple', + label: 'Brave', + value: 'BRAVE', + position: 4, + }, + { + id: '4942a08c-00fd-43a1-99bb-79288d9c4e6a', + color: 'orange', + label: 'Curious', + value: 'CURIOUS', + position: 5, + }, + ], + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '5aaf6be0-b9f5-4222-9810-941d5ab58527', + flatRelationTargetFieldMetadata: null, + }), + comments: getFlatFieldMetadataMock({ + id: '2e726631-d80a-4594-9a5a-3cca0c2a50a9', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.TEXT, + name: 'comments', + label: 'Comments', + defaultValue: "''", + description: null, + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '2e726631-d80a-4594-9a5a-3cca0c2a50a9', + flatRelationTargetFieldMetadata: null, + }), + age: getFlatFieldMetadataMock({ + id: 'ed1573cf-b29e-4d4f-a8e3-19d472d28c0d', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.NUMBER, + name: 'age', + label: 'Age', + defaultValue: null, + description: null, + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: 'ed1573cf-b29e-4d4f-a8e3-19d472d28c0d', + flatRelationTargetFieldMetadata: null, + }), + location: getFlatFieldMetadataMock({ + id: '7b05e127-d0ea-422a-8f98-ef48f41d4388', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.ADDRESS, + name: 'location', + label: 'Location', + defaultValue: { + addressLat: null, + addressLng: null, + addressCity: "''", + addressState: "''", + addressCountry: "''", + addressStreet1: "''", + addressStreet2: "''", + addressPostcode: "''", + }, + description: null, + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '7b05e127-d0ea-422a-8f98-ef48f41d4388', + flatRelationTargetFieldMetadata: null, + }), + vetPhone: getFlatFieldMetadataMock({ + id: '92c856ef-5b4b-4202-8c23-b2f22f959eda', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.PHONES, + name: 'vetPhone', + label: 'Vet phone', + defaultValue: { + additionalPhones: null, + primaryPhoneNumber: "''", + primaryPhoneCallingCode: "''", + primaryPhoneCountryCode: "''", + }, + description: null, + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '92c856ef-5b4b-4202-8c23-b2f22f959eda', + flatRelationTargetFieldMetadata: null, + }), + vetEmail: getFlatFieldMetadataMock({ + id: '2c89697d-925a-485c-a0ed-adf2f1228e0f', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.EMAILS, + name: 'vetEmail', + label: 'Vet email', + defaultValue: { primaryEmail: "''", additionalEmails: null }, + description: null, + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '2c89697d-925a-485c-a0ed-adf2f1228e0f', + flatRelationTargetFieldMetadata: null, + }), + birthday: getFlatFieldMetadataMock({ + id: '13c5b4ed-5746-494f-856b-081bdbb4a8ec', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.DATE, + name: 'birthday', + label: 'Birthday', + defaultValue: null, + description: null, + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '13c5b4ed-5746-494f-856b-081bdbb4a8ec', + flatRelationTargetFieldMetadata: null, + }), + isGoodWithKids: getFlatFieldMetadataMock({ + id: 'ec3bf27e-70e6-4d4a-932e-6ef026013603', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.BOOLEAN, + name: 'isGoodWithKids', + label: 'Is good with kids', + defaultValue: null, + description: null, + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: 'ec3bf27e-70e6-4d4a-932e-6ef026013603', + flatRelationTargetFieldMetadata: null, + }), + pictures: getFlatFieldMetadataMock({ + id: '8aa0a700-c308-4d8b-8fbd-f545daa8980a', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.LINKS, + name: 'pictures', + label: 'Pictures', + defaultValue: { + primaryLinkUrl: "''", + secondaryLinks: [], + primaryLinkLabel: "''", + }, + description: null, + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '8aa0a700-c308-4d8b-8fbd-f545daa8980a', + flatRelationTargetFieldMetadata: null, + }), + averageCostOfKibblePerMonth: getFlatFieldMetadataMock({ + id: '37421848-b64d-4827-be33-da4e337acbb6', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.CURRENCY, + name: 'averageCostOfKibblePerMonth', + label: 'Average cost of kibble per month', + defaultValue: { amountMicros: null, currencyCode: "''" }, + description: null, + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '37421848-b64d-4827-be33-da4e337acbb6', + flatRelationTargetFieldMetadata: null, + }), + makesOwnerThinkOf: getFlatFieldMetadataMock({ + id: '84b874dc-983d-47eb-9c67-54f557a99f60', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.FULL_NAME, + name: 'makesOwnerThinkOf', + label: 'Makes its owner think of', + defaultValue: { lastName: "''", firstName: "''" }, + description: null, + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '84b874dc-983d-47eb-9c67-54f557a99f60', + flatRelationTargetFieldMetadata: null, + }), + soundSwag: getFlatFieldMetadataMock({ + id: '42e6c0d2-6d00-4c77-b179-890af8c56236', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.RATING, + name: 'soundSwag', + label: 'Sound swag (bark style, meow style, etc.)', + defaultValue: null, + description: null, + icon: null, + standardOverrides: null, + options: [ + { + id: '4a3ed94d-30db-4231-8c2e-5893d55df860', + label: '1', + value: 'RATING_1', + position: 0, + }, + { + id: '7b837621-34e5-4a65-be45-9386062150c6', + label: '2', + value: 'RATING_2', + position: 1, + }, + { + id: '1b0aa9fd-c4b9-4714-952f-492da858f766', + label: '3', + value: 'RATING_3', + position: 2, + }, + { + id: '35b92ebf-ecc7-4a9d-9ef2-4739cbfcb61a', + label: '4', + value: 'RATING_4', + position: 3, + }, + { + id: 'a225c6ca-301b-4f90-bb3e-17edbcb84d92', + label: '5', + value: 'RATING_5', + position: 4, + }, + ], + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '42e6c0d2-6d00-4c77-b179-890af8c56236', + flatRelationTargetFieldMetadata: null, + }), + bio: getFlatFieldMetadataMock({ + id: 'fa0ec409-0f29-4b19-b304-31d1018a2344', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.RICH_TEXT, + name: 'bio', + label: 'Bio', + defaultValue: null, + description: null, + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: 'fa0ec409-0f29-4b19-b304-31d1018a2344', + flatRelationTargetFieldMetadata: null, + }), + interestingFacts: getFlatFieldMetadataMock({ + id: '2b806a74-e7a5-4ec7-b902-67cf811e8bda', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.ARRAY, + name: 'interestingFacts', + label: 'Interesting facts', + defaultValue: null, + description: null, + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '2b806a74-e7a5-4ec7-b902-67cf811e8bda', + flatRelationTargetFieldMetadata: null, + }), + extraData: getFlatFieldMetadataMock({ + id: 'a79bd7c8-c7ce-416a-9d12-a05335c9c596', + standardId: null, + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.RAW_JSON, + name: 'extraData', + label: 'Extra data', + defaultValue: null, + description: null, + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: true, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: 'a79bd7c8-c7ce-416a-9d12-a05335c9c596', + flatRelationTargetFieldMetadata: null, + }), +} as const satisfies Record; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/rocket-flat-fields.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/rocket-flat-fields.mock.ts new file mode 100644 index 0000000000..aa1de4e731 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/rocket-flat-fields.mock.ts @@ -0,0 +1,470 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + +import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface'; + +import { getFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-flat-field-metadata.mock'; +import { RelationOnDeleteAction } from 'src/engine/metadata-modules/relation-metadata/relation-on-delete-action.type'; +import { FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; + +export const ROCKET_FLAT_FIELDS_MOCK = { + id: getFlatFieldMetadataMock({ + id: 'c7c23914-80c4-46d2-a559-1ce20d07fb3c', + standardId: '20202020-eda0-4cee-9577-3eb357e3c22b', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.UUID, + name: 'id', + label: 'Id', + defaultValue: 'uuid', + description: 'Id', + icon: 'Icon123', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-eda0-4cee-9577-3eb357e3c22b', + flatRelationTargetFieldMetadata: null, + }), + name: getFlatFieldMetadataMock({ + id: '9c10de36-1ade-4be1-af78-c4fc55669fbd', + standardId: '20202020-ba07-4ffd-ba63-009491f5749c', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.TEXT, + name: 'name', + label: 'Name', + defaultValue: "'Untitled'", + description: 'Name', + icon: 'IconAbc', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-ba07-4ffd-ba63-009491f5749c', + flatRelationTargetFieldMetadata: null, + }), + createdAt: getFlatFieldMetadataMock({ + id: '7aa0896a-82dd-43c0-b38f-a316a8064d51', + standardId: '20202020-66ac-4502-9975-e4d959c50311', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.DATE_TIME, + name: 'createdAt', + label: 'Creation date', + defaultValue: 'now', + description: 'Creation date', + icon: 'IconCalendar', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-66ac-4502-9975-e4d959c50311', + flatRelationTargetFieldMetadata: null, + }), + updatedAt: getFlatFieldMetadataMock({ + id: '1ca95b19-f02d-43c1-b9ae-8a9d522bb34b', + standardId: '20202020-d767-4622-bdcf-d8a084834d86', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.DATE_TIME, + name: 'updatedAt', + label: 'Last update', + defaultValue: 'now', + description: 'Last time the record was changed', + icon: 'IconCalendarClock', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-d767-4622-bdcf-d8a084834d86', + flatRelationTargetFieldMetadata: null, + }), + deletedAt: getFlatFieldMetadataMock({ + id: 'aae8d11a-27b3-4844-a68f-a2023ae12443', + standardId: '20202020-b9a7-48d8-8387-b9a3090a50ec', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.DATE_TIME, + name: 'deletedAt', + label: 'Deleted at', + defaultValue: null, + description: 'Deletion date', + icon: 'IconCalendarClock', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b9a7-48d8-8387-b9a3090a50ec', + flatRelationTargetFieldMetadata: null, + }), + createdBy: getFlatFieldMetadataMock({ + id: '23ebf744-88ad-4d0f-9084-a63e29c4655b', + standardId: '20202020-be0e-4971-865b-32ca87cbb315', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + defaultValue: { name: "''", source: "'MANUAL'" }, + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-be0e-4971-865b-32ca87cbb315', + flatRelationTargetFieldMetadata: null, + }), + position: getFlatFieldMetadataMock({ + id: '2f1976a6-ae59-43c5-85bc-49fb8fd03e18', + standardId: '20202020-c2bd-4e16-bb9a-c8b0411bf49d', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + defaultValue: 0, + description: 'Position', + icon: 'IconHierarchy2', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-c2bd-4e16-bb9a-c8b0411bf49d', + flatRelationTargetFieldMetadata: null, + }), + timelineActivities: getFlatFieldMetadataMock({ + id: '53a223cc-a445-420d-8698-1a9137039448', + standardId: '20202020-f1ef-4ba4-8f33-1a4577afa477', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'TimelineActivities', + defaultValue: null, + description: 'TimelineActivities tied to the Rocket', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'eebb9590-817b-4a51-88f7-9792aa8e0a59', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-f1ef-4ba4-8f33-1a4577afa477', + flatRelationTargetFieldMetadata: { + id: 'eebb9590-817b-4a51-88f7-9792aa8e0a59', + standardId: '20202020-0be6-444e-88f0-12e0c64ac27d', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'rocket', + label: 'Rocket', + defaultValue: null, + description: 'TimelineActivities Rocket', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'rocketId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '53a223cc-a445-420d-8698-1a9137039448', + relationTargetObjectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + uniqueIdentifier: '20202020-0be6-444e-88f0-12e0c64ac27d', + }, + }), + favorites: getFlatFieldMetadataMock({ + id: '14010360-f3c2-442e-b05f-43c30158f246', + standardId: '20202020-a4a7-4686-b296-1c6c3482ee21', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.RELATION, + name: 'favorites', + label: 'Favorites', + defaultValue: null, + description: 'Favorites tied to the Rocket', + icon: 'IconHeart', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '9448627d-725d-499e-a071-90fd5cfcf0ea', + relationTargetObjectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + uniqueIdentifier: '20202020-a4a7-4686-b296-1c6c3482ee21', + flatRelationTargetFieldMetadata: { + id: '9448627d-725d-499e-a071-90fd5cfcf0ea', + standardId: '20202020-78f7-4d7d-86e9-7562ced0b381', + objectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + type: FieldMetadataType.RELATION, + name: 'rocket', + label: 'Rocket', + defaultValue: null, + description: 'Favorites Rocket', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'rocketId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '14010360-f3c2-442e-b05f-43c30158f246', + relationTargetObjectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + uniqueIdentifier: '20202020-78f7-4d7d-86e9-7562ced0b381', + }, + }), + attachments: getFlatFieldMetadataMock({ + id: 'f5984acf-5128-42ac-840f-9d2888423699', + standardId: '20202020-8d59-46ca-b7b2-73d167712134', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Attachments tied to the Rocket', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'ba23019c-7f25-42c3-8138-622e61c42968', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-8d59-46ca-b7b2-73d167712134', + flatRelationTargetFieldMetadata: { + id: 'ba23019c-7f25-42c3-8138-622e61c42968', + standardId: '20202020-ca2d-47c0-8253-9d0b662fb01a', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'rocket', + label: 'Rocket', + defaultValue: null, + description: 'Attachments Rocket', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'rocketId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'f5984acf-5128-42ac-840f-9d2888423699', + relationTargetObjectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + uniqueIdentifier: '20202020-ca2d-47c0-8253-9d0b662fb01a', + }, + }), + noteTargets: getFlatFieldMetadataMock({ + id: 'c91376fb-20bd-47c7-8922-b64f7db51cfa', + standardId: '20202020-01fd-4f37-99dc-9427a444018a', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.RELATION, + name: 'noteTargets', + label: 'NoteTargets', + defaultValue: null, + description: 'NoteTargets tied to the Rocket', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '4212b3d7-dd9f-4da9-85f7-2fa69a42296f', + relationTargetObjectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + uniqueIdentifier: '20202020-01fd-4f37-99dc-9427a444018a', + flatRelationTargetFieldMetadata: { + id: '4212b3d7-dd9f-4da9-85f7-2fa69a42296f', + standardId: '20202020-52b6-4d5e-8f21-ed8b7c09c4a9', + objectMetadataId: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + type: FieldMetadataType.RELATION, + name: 'rocket', + label: 'Rocket', + defaultValue: null, + description: 'NoteTargets Rocket', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'rocketId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'c91376fb-20bd-47c7-8922-b64f7db51cfa', + relationTargetObjectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + uniqueIdentifier: '20202020-52b6-4d5e-8f21-ed8b7c09c4a9', + }, + }), + taskTargets: getFlatFieldMetadataMock({ + id: '80e3b587-69ec-48bc-a872-20105c3b7df4', + standardId: '20202020-0860-4566-b865-bff3c626c303', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.RELATION, + name: 'taskTargets', + label: 'TaskTargets', + defaultValue: null, + description: 'TaskTargets tied to the Rocket', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'a7e80fd8-76bc-45ed-b843-a2b87ef4d601', + relationTargetObjectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + uniqueIdentifier: '20202020-0860-4566-b865-bff3c626c303', + flatRelationTargetFieldMetadata: { + id: 'a7e80fd8-76bc-45ed-b843-a2b87ef4d601', + standardId: '20202020-b98f-473d-85fb-8cebc40b9a50', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.RELATION, + name: 'rocket', + label: 'Rocket', + defaultValue: null, + description: 'TaskTargets Rocket', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'rocketId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '80e3b587-69ec-48bc-a872-20105c3b7df4', + relationTargetObjectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + uniqueIdentifier: '20202020-b98f-473d-85fb-8cebc40b9a50', + }, + }), + searchVector: getFlatFieldMetadataMock({ + id: 'e7609ea3-5a88-4d64-b0c1-eefd4602361a', + standardId: '70e56537-18ef-4811-b1c7-0a444006b815', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + defaultValue: null, + description: 'Field used for full-text search', + icon: null, + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: false, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '70e56537-18ef-4811-b1c7-0a444006b815', + flatRelationTargetFieldMetadata: null, + }), +} as const satisfies Record; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/task-flat-fields.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/task-flat-fields.mock.ts new file mode 100644 index 0000000000..6f37e332c3 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/task-flat-fields.mock.ts @@ -0,0 +1,572 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + +import { DateDisplayFormat } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-settings.interface'; +import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface'; + +import { getFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-flat-field-metadata.mock'; +import { FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; +import { RelationOnDeleteAction } from 'src/engine/metadata-modules/relation-metadata/relation-on-delete-action.type'; + +export const TASK_FLAT_FIELDS_MOCK = { + position: getFlatFieldMetadataMock({ + id: '53134864-086f-40ab-a455-11417542ebd4', + standardId: '20202020-7d47-4690-8a98-98b9a0c05dd8', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + defaultValue: 0, + description: 'Task record position', + icon: 'IconHierarchy2', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-7d47-4690-8a98-98b9a0c05dd8', + flatRelationTargetFieldMetadata: null, + }), + title: getFlatFieldMetadataMock({ + id: '88e4eeac-1d47-4e44-a795-bb5ca93c6557', + standardId: '20202020-b386-4cb7-aa5a-08d4a4d92680', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.TEXT, + name: 'title', + label: 'Title', + defaultValue: "''", + description: 'Task title', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b386-4cb7-aa5a-08d4a4d92680', + flatRelationTargetFieldMetadata: null, + }), + bodyV2: getFlatFieldMetadataMock({ + id: '161570ed-7fcd-4172-a5d1-c773cd9afe76', + standardId: '20202020-4aa0-4ae8-898d-7df0afd47ab1', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.RICH_TEXT_V2, + name: 'bodyV2', + label: 'Body', + defaultValue: null, + description: 'Task body', + icon: 'IconFilePencil', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-4aa0-4ae8-898d-7df0afd47ab1', + flatRelationTargetFieldMetadata: null, + }), + dueAt: getFlatFieldMetadataMock({ + id: '1723b01e-e10b-4410-8cc2-3e0b937754e4', + standardId: '20202020-fd99-40da-951b-4cb9a352fce3', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.DATE_TIME, + name: 'dueAt', + label: 'Due Date', + defaultValue: null, + description: 'Task due date', + icon: 'IconCalendarEvent', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-fd99-40da-951b-4cb9a352fce3', + flatRelationTargetFieldMetadata: null, + }), + status: getFlatFieldMetadataMock({ + id: '44924cd6-fa70-4239-8c22-f17107f83574', + standardId: '20202020-70bc-48f9-89c5-6aa730b151e0', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.SELECT, + name: 'status', + label: 'Status', + defaultValue: "'TODO'", + description: 'Task status', + icon: 'IconCheck', + standardOverrides: null, + options: [ + { + id: '178a8a6f-6411-4731-a417-36e85e5526a3', + color: 'sky', + label: 'To do', + value: 'TODO', + position: 0, + }, + { + id: 'f6543bd8-3c5e-47ff-b61f-0c2821efd7bf', + color: 'purple', + label: 'In progress', + value: 'IN_PROGRESS', + position: 1, + }, + { + id: '50513334-67ca-4126-ba06-95a1be572ea5', + color: 'green', + label: 'Done', + value: 'DONE', + position: 2, + }, + ], + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-70bc-48f9-89c5-6aa730b151e0', + flatRelationTargetFieldMetadata: null, + }), + createdBy: getFlatFieldMetadataMock({ + id: '575c3d51-5cdc-4ff0-aa67-dcc7f1ba2448', + standardId: '20202020-1a04-48ab-a567-576965ae5387', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + defaultValue: { + name: "'System'", + source: "'MANUAL'", + workspaceMemberId: null, + }, + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-1a04-48ab-a567-576965ae5387', + flatRelationTargetFieldMetadata: null, + }), + searchVector: getFlatFieldMetadataMock({ + id: 'bc00547b-b4c5-4d49-a4f1-97159df5cbc1', + standardId: '20202020-4746-4e2f-870c-52b02c67c90d', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + defaultValue: null, + description: 'Field used for full-text search', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-4746-4e2f-870c-52b02c67c90d', + flatRelationTargetFieldMetadata: null, + }), + id: getFlatFieldMetadataMock({ + id: 'dc9b18f9-237c-40ba-97c1-e92c2d7c8e2e', + standardId: '20202020-eda0-4cee-9577-3eb357e3c22b', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.UUID, + name: 'id', + label: 'Id', + defaultValue: 'uuid', + description: 'Id', + icon: 'Icon123', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-eda0-4cee-9577-3eb357e3c22b', + flatRelationTargetFieldMetadata: null, + }), + createdAt: getFlatFieldMetadataMock({ + id: '10c9e428-0739-48a6-8c39-28e6935dfb7c', + standardId: '20202020-66ac-4502-9975-e4d959c50311', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.DATE_TIME, + name: 'createdAt', + label: 'Creation date', + defaultValue: 'now', + description: 'Creation date', + icon: 'IconCalendar', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-66ac-4502-9975-e4d959c50311', + flatRelationTargetFieldMetadata: null, + }), + updatedAt: getFlatFieldMetadataMock({ + id: 'cafcc785-7940-4d27-92e3-ba4b5be5af03', + standardId: '20202020-d767-4622-bdcf-d8a084834d86', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.DATE_TIME, + name: 'updatedAt', + label: 'Last update', + defaultValue: 'now', + description: 'Last time the record was changed', + icon: 'IconCalendarClock', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-d767-4622-bdcf-d8a084834d86', + flatRelationTargetFieldMetadata: null, + }), + deletedAt: getFlatFieldMetadataMock({ + id: 'aa440383-fb91-492c-948f-5b57275cf8e1', + standardId: '20202020-b9a7-48d8-8387-b9a3090a50ec', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.DATE_TIME, + name: 'deletedAt', + label: 'Deleted at', + defaultValue: null, + description: 'Date when the record was deleted', + icon: 'IconCalendarMinus', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b9a7-48d8-8387-b9a3090a50ec', + flatRelationTargetFieldMetadata: null, + }), + taskTargets: getFlatFieldMetadataMock({ + id: 'cd08bc00-d02c-48d4-a1ac-a0cfa13742b7', + standardId: '20202020-de9c-4d0e-a452-713d4a3e5fc7', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.RELATION, + name: 'taskTargets', + label: 'Relations', + defaultValue: null, + description: 'Task targets', + icon: 'IconArrowUpRight', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'c906885c-315a-4783-942e-6caafecf2031', + relationTargetObjectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + uniqueIdentifier: '20202020-de9c-4d0e-a452-713d4a3e5fc7', + flatRelationTargetFieldMetadata: { + id: 'c906885c-315a-4783-942e-6caafecf2031', + standardId: '20202020-e881-457a-8758-74aaef4ae78a', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.RELATION, + name: 'task', + label: 'Task', + defaultValue: null, + description: 'TaskTarget task', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'taskId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'cd08bc00-d02c-48d4-a1ac-a0cfa13742b7', + relationTargetObjectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + uniqueIdentifier: '20202020-e881-457a-8758-74aaef4ae78a', + }, + }), + attachments: getFlatFieldMetadataMock({ + id: '00fd339a-6431-465d-9524-09b5c804f497', + standardId: '20202020-794d-4783-a8ff-cecdb15be139', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.RELATION, + name: 'attachments', + label: 'Attachments', + defaultValue: null, + description: 'Task attachments', + icon: 'IconFileImport', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'bd823f17-f923-4f0d-8533-51d7bc062975', + relationTargetObjectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + uniqueIdentifier: '20202020-794d-4783-a8ff-cecdb15be139', + flatRelationTargetFieldMetadata: { + id: 'bd823f17-f923-4f0d-8533-51d7bc062975', + standardId: '20202020-51e5-4621-9cf8-215487951c4b', + objectMetadataId: '819ed5ff-312f-4423-8e95-02a691cf5c27', + type: FieldMetadataType.RELATION, + name: 'task', + label: 'Task', + defaultValue: null, + description: 'Attachment task', + icon: 'IconNotes', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'taskId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '00fd339a-6431-465d-9524-09b5c804f497', + relationTargetObjectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + uniqueIdentifier: '20202020-51e5-4621-9cf8-215487951c4b', + }, + }), + assignee: getFlatFieldMetadataMock({ + id: '0e18f5e1-32c3-4daa-b282-ab64fb629b20', + standardId: '20202020-065a-4f42-a906-e20422c1753f', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.RELATION, + name: 'assignee', + label: 'Assignee', + defaultValue: null, + description: 'Task assignee', + icon: 'IconUserCircle', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'assigneeId', + }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '68779392-f0ec-42b4-9d89-9645ae84039d', + relationTargetObjectMetadataId: '7d8264db-2b55-4b74-81ff-b7064ed43840', + uniqueIdentifier: '20202020-065a-4f42-a906-e20422c1753f', + flatRelationTargetFieldMetadata: { + id: '68779392-f0ec-42b4-9d89-9645ae84039d', + standardId: '20202020-61dc-4a1c-99e8-38ebf8d2bbeb', + objectMetadataId: '7d8264db-2b55-4b74-81ff-b7064ed43840', + type: FieldMetadataType.RELATION, + name: 'assignedTasks', + label: 'Assigned tasks', + defaultValue: null, + description: 'Tasks assigned to the workspace member', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '0e18f5e1-32c3-4daa-b282-ab64fb629b20', + relationTargetObjectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + uniqueIdentifier: '20202020-61dc-4a1c-99e8-38ebf8d2bbeb', + }, + }), + timelineActivities: getFlatFieldMetadataMock({ + id: '3536b3af-76a2-44f5-9d89-1961a0a0a763', + standardId: '20202020-c778-4278-99ee-23a2837aee64', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Timeline Activities', + defaultValue: null, + description: 'Timeline Activities linked to the task.', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '187eaeb8-62c8-4925-815f-946b4768b786', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-c778-4278-99ee-23a2837aee64', + flatRelationTargetFieldMetadata: { + id: '187eaeb8-62c8-4925-815f-946b4768b786', + standardId: '20202020-b2f5-415c-9135-a31dfe49501b', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'task', + label: 'Task', + defaultValue: null, + description: 'Event task', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'taskId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '3536b3af-76a2-44f5-9d89-1961a0a0a763', + relationTargetObjectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + uniqueIdentifier: '20202020-b2f5-415c-9135-a31dfe49501b', + }, + }), + favorites: getFlatFieldMetadataMock({ + id: '33e4eff0-ff0f-4530-802a-cd630481ee84', + standardId: '20202020-4d1d-41ac-b13b-621631298d65', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.RELATION, + name: 'favorites', + label: 'Favorites', + defaultValue: null, + description: 'Favorites linked to the task', + icon: 'IconHeart', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'db16ab78-ea3f-4b67-93e3-6ad9ab1b7273', + relationTargetObjectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + uniqueIdentifier: '20202020-4d1d-41ac-b13b-621631298d65', + flatRelationTargetFieldMetadata: { + id: 'db16ab78-ea3f-4b67-93e3-6ad9ab1b7273', + standardId: '20202020-1b1b-4b3b-8b1b-7f8d6a1d7d5c', + objectMetadataId: 'f4749ffb-dde8-44ff-8b01-d3fc82df0ba2', + type: FieldMetadataType.RELATION, + name: 'task', + label: 'Task', + defaultValue: null, + description: 'Favorite task', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'taskId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '33e4eff0-ff0f-4530-802a-cd630481ee84', + relationTargetObjectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + uniqueIdentifier: '20202020-1b1b-4b3b-8b1b-7f8d6a1d7d5c', + }, + }), +} as const satisfies Record; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/tasktarget-flat-fields.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/tasktarget-flat-fields.mock.ts new file mode 100644 index 0000000000..a3e0c55211 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/tasktarget-flat-fields.mock.ts @@ -0,0 +1,475 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + +import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface'; +import { DateDisplayFormat } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-settings.interface'; + +import { getFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-flat-field-metadata.mock'; +import { RelationOnDeleteAction } from 'src/engine/metadata-modules/relation-metadata/relation-on-delete-action.type'; +import { FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; + +export const TASKTARGET_FLAT_FIELDS_MOCK = { + id: getFlatFieldMetadataMock({ + id: '762d956d-d11a-4fe6-b6c1-182b9f63a56b', + standardId: '20202020-eda0-4cee-9577-3eb357e3c22b', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.UUID, + name: 'id', + label: 'Id', + defaultValue: 'uuid', + description: 'Id', + icon: 'Icon123', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-eda0-4cee-9577-3eb357e3c22b', + flatRelationTargetFieldMetadata: null, + }), + createdAt: getFlatFieldMetadataMock({ + id: '040784f1-4b59-4033-b4c7-7ed426d70b65', + standardId: '20202020-66ac-4502-9975-e4d959c50311', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.DATE_TIME, + name: 'createdAt', + label: 'Creation date', + defaultValue: 'now', + description: 'Creation date', + icon: 'IconCalendar', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-66ac-4502-9975-e4d959c50311', + flatRelationTargetFieldMetadata: null, + }), + updatedAt: getFlatFieldMetadataMock({ + id: '2b0881e8-767b-4428-ae25-b6ac1a97293a', + standardId: '20202020-d767-4622-bdcf-d8a084834d86', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.DATE_TIME, + name: 'updatedAt', + label: 'Last update', + defaultValue: 'now', + description: 'Last time the record was changed', + icon: 'IconCalendarClock', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-d767-4622-bdcf-d8a084834d86', + flatRelationTargetFieldMetadata: null, + }), + deletedAt: getFlatFieldMetadataMock({ + id: '42b66721-a65c-41bf-a1d7-971ff732be12', + standardId: '20202020-b9a7-48d8-8387-b9a3090a50ec', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.DATE_TIME, + name: 'deletedAt', + label: 'Deleted at', + defaultValue: null, + description: 'Date when the record was deleted', + icon: 'IconCalendarMinus', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b9a7-48d8-8387-b9a3090a50ec', + flatRelationTargetFieldMetadata: null, + }), + task: getFlatFieldMetadataMock({ + id: 'c906885c-315a-4783-942e-6caafecf2031', + standardId: '20202020-e881-457a-8758-74aaef4ae78a', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.RELATION, + name: 'task', + label: 'Task', + defaultValue: null, + description: 'TaskTarget task', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'taskId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'cd08bc00-d02c-48d4-a1ac-a0cfa13742b7', + relationTargetObjectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + uniqueIdentifier: '20202020-e881-457a-8758-74aaef4ae78a', + flatRelationTargetFieldMetadata: { + id: 'cd08bc00-d02c-48d4-a1ac-a0cfa13742b7', + standardId: '20202020-de9c-4d0e-a452-713d4a3e5fc7', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.RELATION, + name: 'taskTargets', + label: 'Relations', + defaultValue: null, + description: 'Task targets', + icon: 'IconArrowUpRight', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'c906885c-315a-4783-942e-6caafecf2031', + relationTargetObjectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + uniqueIdentifier: '20202020-de9c-4d0e-a452-713d4a3e5fc7', + }, + }), + person: getFlatFieldMetadataMock({ + id: '64225f87-96c4-4846-9462-e7aa3ad9e182', + standardId: '20202020-c8a0-4e85-a016-87e2349cfbec', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.RELATION, + name: 'person', + label: 'Person', + defaultValue: null, + description: 'TaskTarget person', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'personId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '9609ca31-215e-47fd-9b3b-ab200acb2fa8', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-c8a0-4e85-a016-87e2349cfbec', + flatRelationTargetFieldMetadata: { + id: '9609ca31-215e-47fd-9b3b-ab200acb2fa8', + standardId: '20202020-584b-4d3e-88b6-53ab1fa03c3a', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'taskTargets', + label: 'Tasks', + defaultValue: null, + description: 'Tasks tied to the contact', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '64225f87-96c4-4846-9462-e7aa3ad9e182', + relationTargetObjectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + uniqueIdentifier: '20202020-584b-4d3e-88b6-53ab1fa03c3a', + }, + }), + company: getFlatFieldMetadataMock({ + id: 'ec11b025-1476-4e84-81c5-cf5b5c776edc', + standardId: '20202020-4703-4a4e-948c-487b0c60a92c', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.RELATION, + name: 'company', + label: 'Company', + defaultValue: null, + description: 'TaskTarget company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'companyId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '4f9138da-cd36-4df4-98f9-ebabe036b141', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: '20202020-4703-4a4e-948c-487b0c60a92c', + flatRelationTargetFieldMetadata: { + id: '4f9138da-cd36-4df4-98f9-ebabe036b141', + standardId: '20202020-cb17-4a61-8f8f-3be6730480de', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'taskTargets', + label: 'Tasks', + defaultValue: null, + description: 'Tasks tied to the company', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'ec11b025-1476-4e84-81c5-cf5b5c776edc', + relationTargetObjectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + uniqueIdentifier: '20202020-cb17-4a61-8f8f-3be6730480de', + }, + }), + opportunity: getFlatFieldMetadataMock({ + id: '49afc8d8-dde3-4d19-aa6b-bd16a751b114', + standardId: '20202020-6cb2-4c01-a9a5-aca3dbc11d41', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.RELATION, + name: 'opportunity', + label: 'Opportunity', + defaultValue: null, + description: 'TaskTarget opportunity', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'opportunityId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'c0c9f9ac-0d40-4206-90e5-0d1e14f8a09f', + relationTargetObjectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + uniqueIdentifier: '20202020-6cb2-4c01-a9a5-aca3dbc11d41', + flatRelationTargetFieldMetadata: { + id: 'c0c9f9ac-0d40-4206-90e5-0d1e14f8a09f', + standardId: '20202020-59c0-4179-a208-4a255f04a5be', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.RELATION, + name: 'taskTargets', + label: 'Tasks', + defaultValue: null, + description: 'Tasks tied to the opportunity', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '49afc8d8-dde3-4d19-aa6b-bd16a751b114', + relationTargetObjectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + uniqueIdentifier: '20202020-59c0-4179-a208-4a255f04a5be', + }, + }), + rocket: getFlatFieldMetadataMock({ + id: 'a7e80fd8-76bc-45ed-b843-a2b87ef4d601', + standardId: '20202020-b98f-473d-85fb-8cebc40b9a50', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.RELATION, + name: 'rocket', + label: 'Rocket', + defaultValue: null, + description: 'TaskTargets Rocket', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'rocketId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '80e3b587-69ec-48bc-a872-20105c3b7df4', + relationTargetObjectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + uniqueIdentifier: '20202020-b98f-473d-85fb-8cebc40b9a50', + flatRelationTargetFieldMetadata: { + id: '80e3b587-69ec-48bc-a872-20105c3b7df4', + standardId: '20202020-0860-4566-b865-bff3c626c303', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.RELATION, + name: 'taskTargets', + label: 'TaskTargets', + defaultValue: null, + description: 'TaskTargets tied to the Rocket', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'a7e80fd8-76bc-45ed-b843-a2b87ef4d601', + relationTargetObjectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + uniqueIdentifier: '20202020-0860-4566-b865-bff3c626c303', + }, + }), + pet: getFlatFieldMetadataMock({ + id: '3955a4b4-1c10-4ce8-a92e-98e727ee7aec', + standardId: '20202020-07d9-4d04-8b73-a39ab65943f1', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.RELATION, + name: 'pet', + label: 'Pet', + defaultValue: null, + description: 'TaskTargets Pet', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'petId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '3cae8259-ece8-4b81-9044-f5abae5ff25c', + relationTargetObjectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + uniqueIdentifier: '20202020-07d9-4d04-8b73-a39ab65943f1', + flatRelationTargetFieldMetadata: { + id: '3cae8259-ece8-4b81-9044-f5abae5ff25c', + standardId: '20202020-0860-4566-b865-bff3c626c303', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.RELATION, + name: 'taskTargets', + label: 'TaskTargets', + defaultValue: null, + description: 'TaskTargets tied to the Pet', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '3955a4b4-1c10-4ce8-a92e-98e727ee7aec', + relationTargetObjectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + uniqueIdentifier: '20202020-0860-4566-b865-bff3c626c303', + }, + }), + surveyResult: getFlatFieldMetadataMock({ + id: 'caa8b6cf-c668-4fb0-abf9-e49645668020', + standardId: '20202020-c376-450d-8a49-a573f23eafd8', + objectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + type: FieldMetadataType.RELATION, + name: 'surveyResult', + label: 'Survey result', + defaultValue: null, + description: 'TaskTargets Survey result', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'surveyResultId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'c4004fb2-3464-4302-b3c3-a32a1879fed7', + relationTargetObjectMetadataId: '713da753-0340-49b5-b1fa-add34d2dc9a8', + uniqueIdentifier: '20202020-c376-450d-8a49-a573f23eafd8', + flatRelationTargetFieldMetadata: { + id: 'c4004fb2-3464-4302-b3c3-a32a1879fed7', + standardId: '20202020-0860-4566-b865-bff3c626c303', + objectMetadataId: '713da753-0340-49b5-b1fa-add34d2dc9a8', + type: FieldMetadataType.RELATION, + name: 'taskTargets', + label: 'TaskTargets', + defaultValue: null, + description: 'TaskTargets tied to the Survey result', + icon: 'IconCheckbox', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'caa8b6cf-c668-4fb0-abf9-e49645668020', + relationTargetObjectMetadataId: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + uniqueIdentifier: '20202020-0860-4566-b865-bff3c626c303', + }, + }), +} as const satisfies Record; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/timelineactivity-flat-fields.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/timelineactivity-flat-fields.mock.ts new file mode 100644 index 0000000000..2e008b8de1 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__mocks__/timelineactivity-flat-fields.mock.ts @@ -0,0 +1,885 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + +import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface'; +import { DateDisplayFormat } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-settings.interface'; + +import { getFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-flat-field-metadata.mock'; +import { RelationOnDeleteAction } from 'src/engine/metadata-modules/relation-metadata/relation-on-delete-action.type'; +import { FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; + +export const TIMELINEACTIVITY_FLAT_FIELDS_MOCK = { + happensAt: getFlatFieldMetadataMock({ + id: 'f8bbe593-cc45-4509-ba5f-aff1b4ae78a9', + standardId: '20202020-9526-4993-b339-c4318c4d39f0', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.DATE_TIME, + name: 'happensAt', + label: 'Creation date', + defaultValue: 'now', + description: 'Creation date', + icon: 'IconCalendar', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-9526-4993-b339-c4318c4d39f0', + flatRelationTargetFieldMetadata: null, + }), + name: getFlatFieldMetadataMock({ + id: '8271b048-89c8-4db9-ba49-e20d1e634cea', + standardId: '20202020-7207-46e8-9dab-849505ae8497', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.TEXT, + name: 'name', + label: 'Event name', + defaultValue: "''", + description: 'Event name', + icon: 'IconAbc', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-7207-46e8-9dab-849505ae8497', + flatRelationTargetFieldMetadata: null, + }), + properties: getFlatFieldMetadataMock({ + id: '5067203a-5fc0-47a7-8fb3-466e8edc8e82', + standardId: '20202020-f142-4b04-b91b-6a2b4af3bf11', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RAW_JSON, + name: 'properties', + label: 'Event details', + defaultValue: null, + description: 'Json value for event details', + icon: 'IconListDetails', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-f142-4b04-b91b-6a2b4af3bf11', + flatRelationTargetFieldMetadata: null, + }), + linkedRecordCachedName: getFlatFieldMetadataMock({ + id: '6192bb0a-dcff-4ce9-9373-6b3efd74def3', + standardId: '20202020-cfdb-4bef-bbce-a29f41230934', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.TEXT, + name: 'linkedRecordCachedName', + label: 'Linked Record cached name', + defaultValue: "''", + description: 'Cached record name', + icon: 'IconAbc', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-cfdb-4bef-bbce-a29f41230934', + flatRelationTargetFieldMetadata: null, + }), + linkedRecordId: getFlatFieldMetadataMock({ + id: '1a1b9069-0274-4d89-a189-6944ebd8afd5', + standardId: '20202020-2e0e-48c0-b445-ee6c1e61687d', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.UUID, + name: 'linkedRecordId', + label: 'Linked Record id', + defaultValue: null, + description: 'Linked Record id', + icon: 'IconAbc', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-2e0e-48c0-b445-ee6c1e61687d', + flatRelationTargetFieldMetadata: null, + }), + linkedObjectMetadataId: getFlatFieldMetadataMock({ + id: 'aa0a6096-ddd6-44b3-a8c1-ec4c1ec70c52', + standardId: '20202020-c595-449d-9f89-562758c9ee69', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.UUID, + name: 'linkedObjectMetadataId', + label: 'Linked Object Metadata Id', + defaultValue: null, + description: 'Linked Object Metadata Id', + icon: 'IconAbc', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-c595-449d-9f89-562758c9ee69', + flatRelationTargetFieldMetadata: null, + }), + id: getFlatFieldMetadataMock({ + id: 'e78264fa-48bc-46cd-afc1-c5f2b5eb9472', + standardId: '20202020-eda0-4cee-9577-3eb357e3c22b', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.UUID, + name: 'id', + label: 'Id', + defaultValue: 'uuid', + description: 'Id', + icon: 'Icon123', + standardOverrides: null, + options: null, + settings: null, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-eda0-4cee-9577-3eb357e3c22b', + flatRelationTargetFieldMetadata: null, + }), + createdAt: getFlatFieldMetadataMock({ + id: 'cb8b2800-2a6e-443c-b671-df51c8a8ccdc', + standardId: '20202020-66ac-4502-9975-e4d959c50311', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.DATE_TIME, + name: 'createdAt', + label: 'Creation date', + defaultValue: 'now', + description: 'Creation date', + icon: 'IconCalendar', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-66ac-4502-9975-e4d959c50311', + flatRelationTargetFieldMetadata: null, + }), + updatedAt: getFlatFieldMetadataMock({ + id: 'cc7b974c-4cb3-4b61-821a-824b4764fc6b', + standardId: '20202020-d767-4622-bdcf-d8a084834d86', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.DATE_TIME, + name: 'updatedAt', + label: 'Last update', + defaultValue: 'now', + description: 'Last time the record was changed', + icon: 'IconCalendarClock', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: false, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-d767-4622-bdcf-d8a084834d86', + flatRelationTargetFieldMetadata: null, + }), + deletedAt: getFlatFieldMetadataMock({ + id: '544fdd41-6418-43e4-a46a-086c2c55924d', + standardId: '20202020-b9a7-48d8-8387-b9a3090a50ec', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.DATE_TIME, + name: 'deletedAt', + label: 'Deleted at', + defaultValue: null, + description: 'Date when the record was deleted', + icon: 'IconCalendarMinus', + standardOverrides: null, + options: null, + settings: { displayFormat: DateDisplayFormat.RELATIVE }, + isCustom: false, + isActive: true, + isSystem: false, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: null, + relationTargetObjectMetadataId: null, + uniqueIdentifier: '20202020-b9a7-48d8-8387-b9a3090a50ec', + flatRelationTargetFieldMetadata: null, + }), + workspaceMember: getFlatFieldMetadataMock({ + id: 'c8d9c315-034a-4ffd-a6b3-e6386092d0a8', + standardId: '20202020-af23-4479-9a30-868edc474b36', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'workspaceMember', + label: 'Workspace Member', + defaultValue: null, + description: 'Event workspace member', + icon: 'IconCircleUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'workspaceMemberId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'b2172f26-093d-4c9f-86c3-f0bcfaf54ad6', + relationTargetObjectMetadataId: '7d8264db-2b55-4b74-81ff-b7064ed43840', + uniqueIdentifier: '20202020-af23-4479-9a30-868edc474b36', + flatRelationTargetFieldMetadata: { + id: 'b2172f26-093d-4c9f-86c3-f0bcfaf54ad6', + standardId: '20202020-e15b-47b8-94fe-8200e3c66615', + objectMetadataId: '7d8264db-2b55-4b74-81ff-b7064ed43840', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Events', + defaultValue: null, + description: 'Events linked to the workspace member', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'c8d9c315-034a-4ffd-a6b3-e6386092d0a8', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-e15b-47b8-94fe-8200e3c66615', + }, + }), + person: getFlatFieldMetadataMock({ + id: 'dbd02754-4bef-4149-b39d-54759983ab47', + standardId: '20202020-c414-45b9-a60a-ac27aa96229f', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'person', + label: 'Person', + defaultValue: null, + description: 'Event person', + icon: 'IconUser', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'personId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'b1457347-545b-4a42-9c68-bc655952229a', + relationTargetObjectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + uniqueIdentifier: '20202020-c414-45b9-a60a-ac27aa96229f', + flatRelationTargetFieldMetadata: { + id: 'b1457347-545b-4a42-9c68-bc655952229a', + standardId: '20202020-a43e-4873-9c23-e522de906ce5', + objectMetadataId: '843e0b67-9619-4628-91c4-2fa62256a611', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Events', + defaultValue: null, + description: 'Events linked to the person', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'dbd02754-4bef-4149-b39d-54759983ab47', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-a43e-4873-9c23-e522de906ce5', + }, + }), + company: getFlatFieldMetadataMock({ + id: 'fd8cabe5-7dc8-4d6a-8053-43434488b3e4', + standardId: '20202020-04ad-4221-a744-7a8278a5ce21', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'company', + label: 'Company', + defaultValue: null, + description: 'Event company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'companyId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'cc78390f-f570-4c2c-9f19-2a8fef67f4f6', + relationTargetObjectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + uniqueIdentifier: '20202020-04ad-4221-a744-7a8278a5ce21', + flatRelationTargetFieldMetadata: { + id: 'cc78390f-f570-4c2c-9f19-2a8fef67f4f6', + standardId: '20202020-0414-4daf-9c0d-64fe7b27f89f', + objectMetadataId: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Timeline Activities', + defaultValue: null, + description: 'Timeline Activities linked to the company', + icon: 'IconIconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'fd8cabe5-7dc8-4d6a-8053-43434488b3e4', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-0414-4daf-9c0d-64fe7b27f89f', + }, + }), + opportunity: getFlatFieldMetadataMock({ + id: '026cbaa7-860c-4ed4-b878-8d78849e6c28', + standardId: '20202020-7664-4a35-a3df-580d389fd527', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'opportunity', + label: 'Opportunity', + defaultValue: null, + description: 'Event opportunity', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'opportunityId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '7826944b-3b21-4448-892e-5a2a68161313', + relationTargetObjectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + uniqueIdentifier: '20202020-7664-4a35-a3df-580d389fd527', + flatRelationTargetFieldMetadata: { + id: '7826944b-3b21-4448-892e-5a2a68161313', + standardId: '20202020-30e2-421f-96c7-19c69d1cf631', + objectMetadataId: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Timeline Activities', + defaultValue: null, + description: 'Timeline Activities linked to the opportunity.', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '026cbaa7-860c-4ed4-b878-8d78849e6c28', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-30e2-421f-96c7-19c69d1cf631', + }, + }), + note: getFlatFieldMetadataMock({ + id: '2b9f1c90-9e35-4ccc-8d84-b42de31ef127', + standardId: '20202020-ec55-4135-8da5-3a20badc0156', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'note', + label: 'Note', + defaultValue: null, + description: 'Event note', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'noteId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '1207d260-db2c-41d4-bb09-34ea1188978f', + relationTargetObjectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + uniqueIdentifier: '20202020-ec55-4135-8da5-3a20badc0156', + flatRelationTargetFieldMetadata: { + id: '1207d260-db2c-41d4-bb09-34ea1188978f', + standardId: '20202020-7030-42f8-929c-1a57b25d6bce', + objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Timeline Activities', + defaultValue: null, + description: 'Timeline Activities linked to the note.', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '2b9f1c90-9e35-4ccc-8d84-b42de31ef127', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-7030-42f8-929c-1a57b25d6bce', + }, + }), + task: getFlatFieldMetadataMock({ + id: '187eaeb8-62c8-4925-815f-946b4768b786', + standardId: '20202020-b2f5-415c-9135-a31dfe49501b', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'task', + label: 'Task', + defaultValue: null, + description: 'Event task', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.SET_NULL, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'taskId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '3536b3af-76a2-44f5-9d89-1961a0a0a763', + relationTargetObjectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + uniqueIdentifier: '20202020-b2f5-415c-9135-a31dfe49501b', + flatRelationTargetFieldMetadata: { + id: '3536b3af-76a2-44f5-9d89-1961a0a0a763', + standardId: '20202020-c778-4278-99ee-23a2837aee64', + objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Timeline Activities', + defaultValue: null, + description: 'Timeline Activities linked to the task.', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '187eaeb8-62c8-4925-815f-946b4768b786', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-c778-4278-99ee-23a2837aee64', + }, + }), + workflow: getFlatFieldMetadataMock({ + id: '9973da2e-cc65-41b2-8f52-4130cfa31fc6', + standardId: '20202020-616c-4ad3-a2e9-c477c341e295', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'workflow', + label: 'Workflow', + defaultValue: null, + description: 'Event workflow', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'workflowId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '384db7b5-3551-4774-9258-7082b26b502a', + relationTargetObjectMetadataId: '664c19a5-0693-45d4-a4e5-76c3717db83c', + uniqueIdentifier: '20202020-616c-4ad3-a2e9-c477c341e295', + flatRelationTargetFieldMetadata: { + id: '384db7b5-3551-4774-9258-7082b26b502a', + standardId: '20202020-906e-486a-a798-131a5f081faf', + objectMetadataId: '664c19a5-0693-45d4-a4e5-76c3717db83c', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Timeline Activities', + defaultValue: null, + description: 'Timeline activities linked to the workflow', + icon: null, + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '9973da2e-cc65-41b2-8f52-4130cfa31fc6', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-906e-486a-a798-131a5f081faf', + }, + }), + workflowVersion: getFlatFieldMetadataMock({ + id: '7e5b7033-8c4f-4bdc-9156-6954c268fbb8', + standardId: '20202020-74f1-4711-a129-e14ca0ecd744', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'workflowVersion', + label: 'WorkflowVersion', + defaultValue: null, + description: 'Event workflow version', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'workflowVersionId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '767ab66d-f3d7-4bac-b0be-f738f8c6fda7', + relationTargetObjectMetadataId: '99cf5f27-b41d-4f25-a23b-9e47d27dae9b', + uniqueIdentifier: '20202020-74f1-4711-a129-e14ca0ecd744', + flatRelationTargetFieldMetadata: { + id: '767ab66d-f3d7-4bac-b0be-f738f8c6fda7', + standardId: '20202020-fcb0-4695-b17e-3b43a421c633', + objectMetadataId: '99cf5f27-b41d-4f25-a23b-9e47d27dae9b', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Timeline Activities', + defaultValue: null, + description: 'Timeline activities linked to the version', + icon: null, + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '7e5b7033-8c4f-4bdc-9156-6954c268fbb8', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-fcb0-4695-b17e-3b43a421c633', + }, + }), + workflowRun: getFlatFieldMetadataMock({ + id: '1cd2b19c-f5c5-40b4-ad41-cc7aa3e955b2', + standardId: '20202020-96f0-401b-9186-a3a0759225ac', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'workflowRun', + label: 'Workflow Run', + defaultValue: null, + description: 'Event workflow run', + icon: 'IconTargetArrow', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'workflowRunId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: 'c17fe20f-fcd1-4b21-ac5c-c595473a3af8', + relationTargetObjectMetadataId: '06d95e96-b050-443f-946e-dd276d291a2f', + uniqueIdentifier: '20202020-96f0-401b-9186-a3a0759225ac', + flatRelationTargetFieldMetadata: { + id: 'c17fe20f-fcd1-4b21-ac5c-c595473a3af8', + standardId: '20202020-af4d-4eb0-babc-eb960a45b356', + objectMetadataId: '06d95e96-b050-443f-946e-dd276d291a2f', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'Timeline Activities', + defaultValue: null, + description: 'Timeline activities linked to the run', + icon: null, + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: true, + relationTargetFieldMetadataId: '1cd2b19c-f5c5-40b4-ad41-cc7aa3e955b2', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-af4d-4eb0-babc-eb960a45b356', + }, + }), + rocket: getFlatFieldMetadataMock({ + id: 'eebb9590-817b-4a51-88f7-9792aa8e0a59', + standardId: '20202020-0be6-444e-88f0-12e0c64ac27d', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'rocket', + label: 'Rocket', + defaultValue: null, + description: 'TimelineActivities Rocket', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'rocketId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '53a223cc-a445-420d-8698-1a9137039448', + relationTargetObjectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + uniqueIdentifier: '20202020-0be6-444e-88f0-12e0c64ac27d', + flatRelationTargetFieldMetadata: { + id: '53a223cc-a445-420d-8698-1a9137039448', + standardId: '20202020-f1ef-4ba4-8f33-1a4577afa477', + objectMetadataId: 'd78ec657-74a4-4652-a350-1f44ff62970a', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'TimelineActivities', + defaultValue: null, + description: 'TimelineActivities tied to the Rocket', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'eebb9590-817b-4a51-88f7-9792aa8e0a59', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-f1ef-4ba4-8f33-1a4577afa477', + }, + }), + pet: getFlatFieldMetadataMock({ + id: '3cb86390-4ee7-42fa-bd1e-bd6326b47610', + standardId: '20202020-d88f-4020-8c85-d6c600903762', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'pet', + label: 'Pet', + defaultValue: null, + description: 'TimelineActivities Pet', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'petId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '4eb74f21-1cb4-46b5-b3bb-4e41108e70d9', + relationTargetObjectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + uniqueIdentifier: '20202020-d88f-4020-8c85-d6c600903762', + flatRelationTargetFieldMetadata: { + id: '4eb74f21-1cb4-46b5-b3bb-4e41108e70d9', + standardId: '20202020-f1ef-4ba4-8f33-1a4577afa477', + objectMetadataId: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'TimelineActivities', + defaultValue: null, + description: 'TimelineActivities tied to the Pet', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '3cb86390-4ee7-42fa-bd1e-bd6326b47610', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-f1ef-4ba4-8f33-1a4577afa477', + }, + }), + surveyResult: getFlatFieldMetadataMock({ + id: '06010d88-dc3c-4172-92c9-8c73924f950d', + standardId: '20202020-d13a-4342-8df0-df48bd783787', + objectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + type: FieldMetadataType.RELATION, + name: 'surveyResult', + label: 'Survey result', + defaultValue: null, + description: 'TimelineActivities Survey result', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + options: null, + settings: { + onDelete: RelationOnDeleteAction.CASCADE, + relationType: RelationType.MANY_TO_ONE, + joinColumnName: 'surveyResultId', + }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: 'd544ccb4-b0df-43bb-b70c-57ae477838c4', + relationTargetObjectMetadataId: '713da753-0340-49b5-b1fa-add34d2dc9a8', + uniqueIdentifier: '20202020-d13a-4342-8df0-df48bd783787', + flatRelationTargetFieldMetadata: { + id: 'd544ccb4-b0df-43bb-b70c-57ae477838c4', + standardId: '20202020-f1ef-4ba4-8f33-1a4577afa477', + objectMetadataId: '713da753-0340-49b5-b1fa-add34d2dc9a8', + type: FieldMetadataType.RELATION, + name: 'timelineActivities', + label: 'TimelineActivities', + defaultValue: null, + description: 'TimelineActivities tied to the Survey result', + icon: 'IconTimelineEvent', + standardOverrides: null, + options: null, + settings: { relationType: RelationType.ONE_TO_MANY }, + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + isLabelSyncedWithName: false, + relationTargetFieldMetadataId: '06010d88-dc3c-4172-92c9-8c73924f950d', + relationTargetObjectMetadataId: '3090f830-c4b1-41a1-8e18-815760830bec', + uniqueIdentifier: '20202020-f1ef-4ba4-8f33-1a4577afa477', + }, + }), +} as const satisfies Record; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata-maps/mocks/flat-object-metadata-maps.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata-maps/mocks/flat-object-metadata-maps.mock.ts new file mode 100644 index 0000000000..6bcf338cb2 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata-maps/mocks/flat-object-metadata-maps.mock.ts @@ -0,0 +1,7 @@ +import { ALL_FLAT_OBJECT_METADATA_MOCKS } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/all-flat-object.mock'; +import { fromFlatObjectMetadatasToFlatObjectMetadataMaps } from 'src/engine/metadata-modules/flat-object-metadata/utils/from-flat-object-metadatas-to-flat-object-metadata-maps.util'; + +export const FLAT_OBJECT_METADATA_MAPS_MOCKS = + fromFlatObjectMetadatasToFlatObjectMetadataMaps([ + ...ALL_FLAT_OBJECT_METADATA_MOCKS, + ]); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/all-flat-object-metadatas.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/all-flat-object-metadatas.mock.ts new file mode 100644 index 0000000000..9bd5adc860 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/all-flat-object-metadatas.mock.ts @@ -0,0 +1,25 @@ +import { ATTACHMENT_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/attachment-flat-object.mock'; +import { COMPANY_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/company-flat-object.mock'; +import { NOTE_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/note-flat-object.mock'; +import { NOTETARGET_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/notetarget-flat-object.mock'; +import { OPPORTUNITY_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/opportunity-flat-object.mock'; +import { PERSON_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/person-flat-object.mock'; +import { PET_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/pet-flat-object.mock'; +import { ROCKET_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/rocket-flat-object.mock'; +import { TASK_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/task-flat-object.mock'; +import { TASKTARGET_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/tasktarget-flat-object.mock'; +import { TIMELINEACTIVITY_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/timelineactivity-flat-object.mock'; + +export const ALL_FLAT_OBJECT_METADATA_MOCKS = [ + TIMELINEACTIVITY_FLAT_OBJECT_MOCK, + NOTETARGET_FLAT_OBJECT_MOCK, + OPPORTUNITY_FLAT_OBJECT_MOCK, + PERSON_FLAT_OBJECT_MOCK, + TASK_FLAT_OBJECT_MOCK, + TASKTARGET_FLAT_OBJECT_MOCK, + PET_FLAT_OBJECT_MOCK, + ROCKET_FLAT_OBJECT_MOCK, + NOTE_FLAT_OBJECT_MOCK, + COMPANY_FLAT_OBJECT_MOCK, + ATTACHMENT_FLAT_OBJECT_MOCK, +] as const; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/all-flat-object.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/all-flat-object.mock.ts new file mode 100644 index 0000000000..9bd5adc860 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/all-flat-object.mock.ts @@ -0,0 +1,25 @@ +import { ATTACHMENT_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/attachment-flat-object.mock'; +import { COMPANY_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/company-flat-object.mock'; +import { NOTE_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/note-flat-object.mock'; +import { NOTETARGET_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/notetarget-flat-object.mock'; +import { OPPORTUNITY_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/opportunity-flat-object.mock'; +import { PERSON_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/person-flat-object.mock'; +import { PET_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/pet-flat-object.mock'; +import { ROCKET_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/rocket-flat-object.mock'; +import { TASK_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/task-flat-object.mock'; +import { TASKTARGET_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/tasktarget-flat-object.mock'; +import { TIMELINEACTIVITY_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/timelineactivity-flat-object.mock'; + +export const ALL_FLAT_OBJECT_METADATA_MOCKS = [ + TIMELINEACTIVITY_FLAT_OBJECT_MOCK, + NOTETARGET_FLAT_OBJECT_MOCK, + OPPORTUNITY_FLAT_OBJECT_MOCK, + PERSON_FLAT_OBJECT_MOCK, + TASK_FLAT_OBJECT_MOCK, + TASKTARGET_FLAT_OBJECT_MOCK, + PET_FLAT_OBJECT_MOCK, + ROCKET_FLAT_OBJECT_MOCK, + NOTE_FLAT_OBJECT_MOCK, + COMPANY_FLAT_OBJECT_MOCK, + ATTACHMENT_FLAT_OBJECT_MOCK, +] as const; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/attachment-flat-object.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/attachment-flat-object.mock.ts new file mode 100644 index 0000000000..450b995bcb --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/attachment-flat-object.mock.ts @@ -0,0 +1,29 @@ +import { ATTACHMENT_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/attachment-flat-fields.mock'; +import { getFlatObjectMetadataMock } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/get-flat-object-metadata.mock'; + +export const ATTACHMENT_FLAT_OBJECT_MOCK = getFlatObjectMetadataMock({ + id: '819ed5ff-312f-4423-8e95-02a691cf5c27', + standardId: '20202020-bd3d-4c60-8dca-571c71d4447a', + nameSingular: 'attachment', + namePlural: 'attachments', + labelSingular: 'Attachment', + labelPlural: 'Attachments', + description: 'An attachment', + icon: 'IconFileImport', + standardOverrides: null, + targetTableName: 'DEPRECATED', + isCustom: false, + isRemote: false, + isActive: true, + isSystem: true, + isAuditLogged: true, + isSearchable: false, + shortcut: null, + labelIdentifierFieldMetadataId: 'f51cfa5d-7190-48a5-b548-3e542322c144', + imageIdentifierFieldMetadataId: null, + isLabelSyncedWithName: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + uniqueIdentifier: '20202020-bd3d-4c60-8dca-571c71d4447a', + flatIndexMetadatas: [], + flatFieldMetadatas: Object.values(ATTACHMENT_FLAT_FIELDS_MOCK), +}); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/company-flat-object.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/company-flat-object.mock.ts new file mode 100644 index 0000000000..c7fff660b8 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/company-flat-object.mock.ts @@ -0,0 +1,29 @@ +import { COMPANY_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/company-flat-fields.mock'; +import { getFlatObjectMetadataMock } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/get-flat-object-metadata.mock'; + +export const COMPANY_FLAT_OBJECT_MOCK = getFlatObjectMetadataMock({ + id: '7f5c2c7a-bb23-46fb-b59d-9b7a52a8d1cc', + standardId: '20202020-b374-4779-a561-80086cb2e17f', + nameSingular: 'company', + namePlural: 'companies', + labelSingular: 'Company', + labelPlural: 'Companies', + description: 'A company', + icon: 'IconBuildingSkyscraper', + standardOverrides: null, + targetTableName: 'DEPRECATED', + isCustom: false, + isRemote: false, + isActive: true, + isSystem: false, + isAuditLogged: true, + isSearchable: true, + shortcut: 'C', + labelIdentifierFieldMetadataId: '12b304b6-ea97-4dcc-9415-9f7b2ac4b729', + imageIdentifierFieldMetadataId: null, + isLabelSyncedWithName: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + uniqueIdentifier: '20202020-b374-4779-a561-80086cb2e17f', + flatIndexMetadatas: [], + flatFieldMetadatas: Object.values(COMPANY_FLAT_FIELDS_MOCK), +}); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/note-flat-object.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/note-flat-object.mock.ts new file mode 100644 index 0000000000..52e595a112 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/note-flat-object.mock.ts @@ -0,0 +1,29 @@ +import { NOTE_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/note-flat-fields.mock'; +import { getFlatObjectMetadataMock } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/get-flat-object-metadata.mock'; + +export const NOTE_FLAT_OBJECT_MOCK = getFlatObjectMetadataMock({ + id: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c', + standardId: '20202020-0b00-45cd-b6f6-6cd806fc6804', + nameSingular: 'note', + namePlural: 'notes', + labelSingular: 'Note', + labelPlural: 'Notes', + description: 'A note', + icon: 'IconNotes', + standardOverrides: null, + targetTableName: 'DEPRECATED', + isCustom: false, + isRemote: false, + isActive: true, + isSystem: false, + isAuditLogged: true, + isSearchable: true, + shortcut: 'N', + labelIdentifierFieldMetadataId: '3cb30a3f-31c1-47d3-a61e-e537615390c8', + imageIdentifierFieldMetadataId: null, + isLabelSyncedWithName: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + uniqueIdentifier: '20202020-0b00-45cd-b6f6-6cd806fc6804', + flatIndexMetadatas: [], + flatFieldMetadatas: Object.values(NOTE_FLAT_FIELDS_MOCK), +}); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/notetarget-flat-object.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/notetarget-flat-object.mock.ts new file mode 100644 index 0000000000..3069255087 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/notetarget-flat-object.mock.ts @@ -0,0 +1,29 @@ +import { NOTETARGET_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/notetarget-flat-fields.mock'; +import { getFlatObjectMetadataMock } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/get-flat-object-metadata.mock'; + +export const NOTETARGET_FLAT_OBJECT_MOCK = getFlatObjectMetadataMock({ + id: '12e3cb51-c3de-4192-b0d5-965d48d001c0', + standardId: '20202020-fff0-4b44-be82-bda313884400', + nameSingular: 'noteTarget', + namePlural: 'noteTargets', + labelSingular: 'Note Target', + labelPlural: 'Note Targets', + description: 'A note target', + icon: 'IconCheckbox', + standardOverrides: null, + targetTableName: 'DEPRECATED', + isCustom: false, + isRemote: false, + isActive: true, + isSystem: true, + isAuditLogged: true, + isSearchable: false, + shortcut: null, + labelIdentifierFieldMetadataId: '3ef6c3df-6569-4d00-b1ae-3893e8e55a7e', + imageIdentifierFieldMetadataId: null, + isLabelSyncedWithName: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + uniqueIdentifier: '20202020-fff0-4b44-be82-bda313884400', + flatIndexMetadatas: [], + flatFieldMetadatas: Object.values(NOTETARGET_FLAT_FIELDS_MOCK), +}); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/opportunity-flat-object.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/opportunity-flat-object.mock.ts new file mode 100644 index 0000000000..be9a06aa0a --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/opportunity-flat-object.mock.ts @@ -0,0 +1,29 @@ +import { OPPORTUNITY_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/opportunity-flat-fields.mock'; +import { getFlatObjectMetadataMock } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/get-flat-object-metadata.mock'; + +export const OPPORTUNITY_FLAT_OBJECT_MOCK = getFlatObjectMetadataMock({ + id: 'e6996bbf-dd41-423a-9324-8546f5b22fa7', + standardId: '20202020-9549-49dd-b2b2-883999db8938', + nameSingular: 'opportunity', + namePlural: 'opportunities', + labelSingular: 'Opportunity', + labelPlural: 'Opportunities', + description: 'An opportunity', + icon: 'IconTargetArrow', + standardOverrides: null, + targetTableName: 'DEPRECATED', + isCustom: false, + isRemote: false, + isActive: true, + isSystem: false, + isAuditLogged: true, + isSearchable: true, + shortcut: 'O', + labelIdentifierFieldMetadataId: '5f510348-58e9-4ded-8dbe-144ae3644bd4', + imageIdentifierFieldMetadataId: null, + isLabelSyncedWithName: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + uniqueIdentifier: '20202020-9549-49dd-b2b2-883999db8938', + flatIndexMetadatas: [], + flatFieldMetadatas: Object.values(OPPORTUNITY_FLAT_FIELDS_MOCK), +}); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/person-flat-object.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/person-flat-object.mock.ts new file mode 100644 index 0000000000..13429b7da0 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/person-flat-object.mock.ts @@ -0,0 +1,29 @@ +import { PERSON_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/person-flat-fields.mock'; +import { getFlatObjectMetadataMock } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/get-flat-object-metadata.mock'; + +export const PERSON_FLAT_OBJECT_MOCK = getFlatObjectMetadataMock({ + id: '843e0b67-9619-4628-91c4-2fa62256a611', + standardId: '20202020-e674-48e5-a542-72570eee7213', + nameSingular: 'person', + namePlural: 'people', + labelSingular: 'Person', + labelPlural: 'People', + description: 'A person', + icon: 'IconUser', + standardOverrides: null, + targetTableName: 'DEPRECATED', + isCustom: false, + isRemote: false, + isActive: true, + isSystem: false, + isAuditLogged: true, + isSearchable: true, + shortcut: 'P', + labelIdentifierFieldMetadataId: 'f410c1cd-2523-4802-be8e-1acc852b4b1a', + imageIdentifierFieldMetadataId: '05e46775-93e9-46c4-8b6f-94829045b1ad', + isLabelSyncedWithName: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + uniqueIdentifier: '20202020-e674-48e5-a542-72570eee7213', + flatIndexMetadatas: [], + flatFieldMetadatas: Object.values(PERSON_FLAT_FIELDS_MOCK), +}); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/pet-flat-object.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/pet-flat-object.mock.ts new file mode 100644 index 0000000000..fd57aa7764 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/pet-flat-object.mock.ts @@ -0,0 +1,29 @@ +import { PET_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/pet-flat-fields.mock'; +import { getFlatObjectMetadataMock } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/get-flat-object-metadata.mock'; + +export const PET_FLAT_OBJECT_MOCK = getFlatObjectMetadataMock({ + id: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + standardId: null, + nameSingular: 'pet', + namePlural: 'pets', + labelSingular: 'Pet', + labelPlural: 'Pets', + description: null, + icon: 'IconCat', + standardOverrides: null, + targetTableName: 'DEPRECATED', + isCustom: true, + isRemote: false, + isActive: true, + isSystem: false, + isAuditLogged: true, + isSearchable: true, + shortcut: null, + labelIdentifierFieldMetadataId: '4311d4e0-ce63-479c-a4da-5b244e2348cc', + imageIdentifierFieldMetadataId: null, + isLabelSyncedWithName: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + uniqueIdentifier: 'd34e0f07-1b8c-4de0-938e-599cf05e1f7f', + flatIndexMetadatas: [], + flatFieldMetadatas: Object.values(PET_FLAT_FIELDS_MOCK), +}); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/rocket-flat-object.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/rocket-flat-object.mock.ts new file mode 100644 index 0000000000..6dcf2f3ea1 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/rocket-flat-object.mock.ts @@ -0,0 +1,29 @@ +import { ROCKET_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/rocket-flat-fields.mock'; +import { getFlatObjectMetadataMock } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/get-flat-object-metadata.mock'; + +export const ROCKET_FLAT_OBJECT_MOCK = getFlatObjectMetadataMock({ + id: 'd78ec657-74a4-4652-a350-1f44ff62970a', + standardId: null, + nameSingular: 'rocket', + namePlural: 'rockets', + labelSingular: 'Rocket', + labelPlural: 'Rockets', + description: 'A rocket', + icon: 'IconRocket', + standardOverrides: null, + targetTableName: 'DEPRECATED', + isCustom: true, + isRemote: false, + isActive: true, + isSystem: false, + isAuditLogged: true, + isSearchable: true, + shortcut: null, + labelIdentifierFieldMetadataId: '9c10de36-1ade-4be1-af78-c4fc55669fbd', + imageIdentifierFieldMetadataId: null, + isLabelSyncedWithName: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + uniqueIdentifier: 'd78ec657-74a4-4652-a350-1f44ff62970a', + flatIndexMetadatas: [], + flatFieldMetadatas: Object.values(ROCKET_FLAT_FIELDS_MOCK), +}); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/task-flat-object.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/task-flat-object.mock.ts new file mode 100644 index 0000000000..a04deea47b --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/task-flat-object.mock.ts @@ -0,0 +1,29 @@ +import { TASK_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/task-flat-fields.mock'; +import { getFlatObjectMetadataMock } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/get-flat-object-metadata.mock'; + +export const TASK_FLAT_OBJECT_MOCK = getFlatObjectMetadataMock({ + id: '3186920d-2a15-4b5f-96c7-2bf6567024b0', + standardId: '20202020-1ba1-48ba-bc83-ef7e5990ed10', + nameSingular: 'task', + namePlural: 'tasks', + labelSingular: 'Task', + labelPlural: 'Tasks', + description: 'A task', + icon: 'IconCheckbox', + standardOverrides: null, + targetTableName: 'DEPRECATED', + isCustom: false, + isRemote: false, + isActive: true, + isSystem: false, + isAuditLogged: true, + isSearchable: true, + shortcut: 'T', + labelIdentifierFieldMetadataId: '88e4eeac-1d47-4e44-a795-bb5ca93c6557', + imageIdentifierFieldMetadataId: null, + isLabelSyncedWithName: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + uniqueIdentifier: '20202020-1ba1-48ba-bc83-ef7e5990ed10', + flatIndexMetadatas: [], + flatFieldMetadatas: Object.values(TASK_FLAT_FIELDS_MOCK), +}); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/tasktarget-flat-object.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/tasktarget-flat-object.mock.ts new file mode 100644 index 0000000000..7bd58c99a9 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/tasktarget-flat-object.mock.ts @@ -0,0 +1,29 @@ +import { TASKTARGET_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/tasktarget-flat-fields.mock'; +import { getFlatObjectMetadataMock } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/get-flat-object-metadata.mock'; + +export const TASKTARGET_FLAT_OBJECT_MOCK = getFlatObjectMetadataMock({ + id: 'bb2b29b8-7f46-4106-a8ae-3a32df9c9166', + standardId: '20202020-5a9a-44e8-95df-771cd06d0fb1', + nameSingular: 'taskTarget', + namePlural: 'taskTargets', + labelSingular: 'Task Target', + labelPlural: 'Task Targets', + description: 'A task target', + icon: 'IconCheckbox', + standardOverrides: null, + targetTableName: 'DEPRECATED', + isCustom: false, + isRemote: false, + isActive: true, + isSystem: true, + isAuditLogged: true, + isSearchable: false, + shortcut: null, + labelIdentifierFieldMetadataId: '762d956d-d11a-4fe6-b6c1-182b9f63a56b', + imageIdentifierFieldMetadataId: null, + isLabelSyncedWithName: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + uniqueIdentifier: '20202020-5a9a-44e8-95df-771cd06d0fb1', + flatIndexMetadatas: [], + flatFieldMetadatas: Object.values(TASKTARGET_FLAT_FIELDS_MOCK), +}); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/timelineactivity-flat-object.mock.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/timelineactivity-flat-object.mock.ts new file mode 100644 index 0000000000..7ea9ba5b66 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/__mocks__/timelineactivity-flat-object.mock.ts @@ -0,0 +1,29 @@ +import { TIMELINEACTIVITY_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/timelineactivity-flat-fields.mock'; +import { getFlatObjectMetadataMock } from 'src/engine/metadata-modules/flat-object-metadata/__mocks__/get-flat-object-metadata.mock'; + +export const TIMELINEACTIVITY_FLAT_OBJECT_MOCK = getFlatObjectMetadataMock({ + id: '3090f830-c4b1-41a1-8e18-815760830bec', + standardId: '20202020-6736-4337-b5c4-8b39fae325a5', + nameSingular: 'timelineActivity', + namePlural: 'timelineActivities', + labelSingular: 'Timeline Activity', + labelPlural: 'Timeline Activities', + description: 'Aggregated / filtered event to be displayed on the timeline', + icon: 'IconTimelineEvent', + standardOverrides: null, + targetTableName: 'DEPRECATED', + isCustom: false, + isRemote: false, + isActive: true, + isSystem: true, + isAuditLogged: false, + isSearchable: false, + shortcut: null, + labelIdentifierFieldMetadataId: 'e78264fa-48bc-46cd-afc1-c5f2b5eb9472', + imageIdentifierFieldMetadataId: null, + isLabelSyncedWithName: false, + workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419', + uniqueIdentifier: '20202020-6736-4337-b5c4-8b39fae325a5', + flatIndexMetadatas: [], + flatFieldMetadatas: Object.values(TIMELINEACTIVITY_FLAT_FIELDS_MOCK), +}); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/from-flat-object-metadatas-to-flat-object-metadata-maps.util.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/from-flat-object-metadatas-to-flat-object-metadata-maps.util.ts new file mode 100644 index 0000000000..4e05f63dc9 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/from-flat-object-metadatas-to-flat-object-metadata-maps.util.ts @@ -0,0 +1,21 @@ +import { FlatObjectMetadataMaps } from 'src/engine/metadata-modules/flat-object-metadata-maps/types/flat-object-metadata-maps.type'; +import { addFlatObjectMetadataToFlatObjectMetadataMapsOrThrow } from 'src/engine/metadata-modules/flat-object-metadata-maps/utils/add-flat-object-metadata-to-flat-object-metadata-maps-or-throw.util'; +import { FlatObjectMetadata } from 'src/engine/metadata-modules/flat-object-metadata/types/flat-object-metadata.type'; + +export const fromFlatObjectMetadatasToFlatObjectMetadataMaps = ( + flatObjectMetadatas: FlatObjectMetadata[], +) => { + const emptyFlatObjectMetadataMaps: FlatObjectMetadataMaps = { + byId: {}, + idByNameSingular: {}, + }; + + return flatObjectMetadatas.reduce( + (flatObjectMetadataMaps, flatObjectMetadata) => + addFlatObjectMetadataToFlatObjectMetadataMapsOrThrow({ + flatObjectMetadata, + flatObjectMetadataMaps, + }), + emptyFlatObjectMetadataMaps, + ); +};