Deprecate ObjectMetadataInterface and improve entity typing (#13310)
# Introduction Following `FieldMetadataInterface` deprecation in https://github.com/twentyhq/twenty/pull/13264 As for the previous PR will rename and remove all the file in a secondary PR to avoid conflicts and over loading this one ## Improvements Removed optional properties from the `objectMetadataEntity` model and added utils to retrieve test data ## Notes By touching to `ObjectMetadataDTO` I would have expected a twenty-front codegenerated types mutation, but it does not seem to be granular enough to null/undefined coercion
This commit is contained in:
@ -2,114 +2,115 @@ import { FieldMetadataType } from 'twenty-shared/types';
|
||||
|
||||
import { WorkspaceEntityDuplicateCriteria } from 'src/engine/api/graphql/workspace-query-builder/types/workspace-entity-duplicate-criteria.type';
|
||||
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||
import { ObjectMetadataItemWithFieldMaps } from 'src/engine/metadata-modules/types/object-metadata-item-with-field-maps';
|
||||
import { getMockFieldMetadataEntity } from 'src/utils/__test__/get-field-metadata-entity.mock';
|
||||
import { getMockObjectMetadataItemWithFieldsMaps } from 'src/utils/__test__/get-object-metadata-item-with-fields-maps.mock';
|
||||
|
||||
const workspaceId = '20202020-1c25-4d02-bf25-6aeccf7ea419';
|
||||
|
||||
export const mockPersonObjectMetadataWithFieldMaps = (
|
||||
duplicateCriteria: WorkspaceEntityDuplicateCriteria[],
|
||||
): ObjectMetadataItemWithFieldMaps => ({
|
||||
id: '',
|
||||
icon: 'Icon123',
|
||||
standardId: '',
|
||||
nameSingular: 'person',
|
||||
namePlural: 'people',
|
||||
labelSingular: 'Person',
|
||||
labelPlural: 'People',
|
||||
description: 'A person',
|
||||
targetTableName: 'DEPRECATED',
|
||||
isCustom: false,
|
||||
isRemote: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isAuditLogged: true,
|
||||
isSearchable: true,
|
||||
duplicateCriteria: duplicateCriteria,
|
||||
labelIdentifierFieldMetadataId: '',
|
||||
imageIdentifierFieldMetadataId: '',
|
||||
workspaceId,
|
||||
indexMetadatas: [],
|
||||
fieldIdByName: {
|
||||
name: 'name-id',
|
||||
emails: 'emails-id',
|
||||
linkedinLink: 'linkedinLink-id',
|
||||
jobTitle: 'jobTitle-id',
|
||||
},
|
||||
fieldIdByJoinColumnName: {},
|
||||
fieldsById: {
|
||||
'name-id': getMockFieldMetadataEntity({
|
||||
workspaceId,
|
||||
objectMetadataId: '',
|
||||
id: 'name-id',
|
||||
type: FieldMetadataType.FULL_NAME,
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
defaultValue: {
|
||||
lastName: "''",
|
||||
firstName: "''",
|
||||
},
|
||||
description: "Contact's name",
|
||||
isCustom: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
'emails-id': getMockFieldMetadataEntity({
|
||||
workspaceId,
|
||||
objectMetadataId: '',
|
||||
id: 'emails-id',
|
||||
type: FieldMetadataType.EMAILS,
|
||||
name: 'emails',
|
||||
label: 'Emails',
|
||||
defaultValue: {
|
||||
primaryEmail: "''",
|
||||
additionalEmails: null,
|
||||
},
|
||||
description: "Contact's Emails",
|
||||
isCustom: false,
|
||||
isNullable: true,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
'linkedinLink-id': getMockFieldMetadataEntity({
|
||||
workspaceId,
|
||||
objectMetadataId: '',
|
||||
id: 'linkedinLink-id',
|
||||
type: FieldMetadataType.LINKS,
|
||||
name: 'linkedinLink',
|
||||
label: 'Linkedin',
|
||||
defaultValue: {
|
||||
primaryLinkUrl: "''",
|
||||
secondaryLinks: [],
|
||||
primaryLinkLabel: "''",
|
||||
},
|
||||
description: "Contact's Linkedin account",
|
||||
isCustom: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
'jobTitle-id': getMockFieldMetadataEntity({
|
||||
workspaceId,
|
||||
objectMetadataId: '',
|
||||
id: 'jobTitle-id',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'jobTitle',
|
||||
label: 'Job Title',
|
||||
defaultValue: "''",
|
||||
description: "Contact's job title",
|
||||
isCustom: false,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
},
|
||||
});
|
||||
) =>
|
||||
getMockObjectMetadataItemWithFieldsMaps({
|
||||
id: '',
|
||||
icon: 'Icon123',
|
||||
standardId: '',
|
||||
nameSingular: 'person',
|
||||
namePlural: 'people',
|
||||
labelSingular: 'Person',
|
||||
labelPlural: 'People',
|
||||
description: 'A person',
|
||||
targetTableName: 'DEPRECATED',
|
||||
isCustom: false,
|
||||
isRemote: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isAuditLogged: true,
|
||||
isSearchable: true,
|
||||
duplicateCriteria: duplicateCriteria,
|
||||
labelIdentifierFieldMetadataId: '',
|
||||
imageIdentifierFieldMetadataId: '',
|
||||
workspaceId,
|
||||
indexMetadatas: [],
|
||||
fieldIdByName: {
|
||||
name: 'name-id',
|
||||
emails: 'emails-id',
|
||||
linkedinLink: 'linkedinLink-id',
|
||||
jobTitle: 'jobTitle-id',
|
||||
},
|
||||
fieldIdByJoinColumnName: {},
|
||||
fieldsById: {
|
||||
'name-id': getMockFieldMetadataEntity({
|
||||
workspaceId,
|
||||
objectMetadataId: '',
|
||||
id: 'name-id',
|
||||
type: FieldMetadataType.FULL_NAME,
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
defaultValue: {
|
||||
lastName: "''",
|
||||
firstName: "''",
|
||||
},
|
||||
description: "Contact's name",
|
||||
isCustom: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
'emails-id': getMockFieldMetadataEntity({
|
||||
workspaceId,
|
||||
objectMetadataId: '',
|
||||
id: 'emails-id',
|
||||
type: FieldMetadataType.EMAILS,
|
||||
name: 'emails',
|
||||
label: 'Emails',
|
||||
defaultValue: {
|
||||
primaryEmail: "''",
|
||||
additionalEmails: null,
|
||||
},
|
||||
description: "Contact's Emails",
|
||||
isCustom: false,
|
||||
isNullable: true,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
'linkedinLink-id': getMockFieldMetadataEntity({
|
||||
workspaceId,
|
||||
objectMetadataId: '',
|
||||
id: 'linkedinLink-id',
|
||||
type: FieldMetadataType.LINKS,
|
||||
name: 'linkedinLink',
|
||||
label: 'Linkedin',
|
||||
defaultValue: {
|
||||
primaryLinkUrl: "''",
|
||||
secondaryLinks: [],
|
||||
primaryLinkLabel: "''",
|
||||
},
|
||||
description: "Contact's Linkedin account",
|
||||
isCustom: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
'jobTitle-id': getMockFieldMetadataEntity({
|
||||
workspaceId,
|
||||
objectMetadataId: '',
|
||||
id: 'jobTitle-id',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'jobTitle',
|
||||
label: 'Job Title',
|
||||
defaultValue: "''",
|
||||
description: "Contact's job title",
|
||||
isCustom: false,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
},
|
||||
});
|
||||
|
||||
@ -5,467 +5,468 @@ import { RelationOnDeleteAction } from 'src/engine/metadata-modules/field-metada
|
||||
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
|
||||
|
||||
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||
import { ObjectMetadataItemWithFieldMaps } from 'src/engine/metadata-modules/types/object-metadata-item-with-field-maps';
|
||||
import { getMockFieldMetadataEntity } from 'src/utils/__test__/get-field-metadata-entity.mock';
|
||||
import { getMockObjectMetadataItemWithFieldsMaps } from 'src/utils/__test__/get-object-metadata-item-with-fields-maps.mock';
|
||||
|
||||
const workspaceId = '20202020-1c25-4d02-bf25-6aeccf7ea419';
|
||||
const objectMetadataId = '20202020-6e2c-42f6-a83c-cc58d776af88';
|
||||
|
||||
export const OPPORTUNITY_WITH_FIELDS_MAPS = {
|
||||
id: objectMetadataId,
|
||||
nameSingular: 'opportunity',
|
||||
namePlural: 'opportunities',
|
||||
labelSingular: 'Opportunity',
|
||||
labelPlural: 'Opportunities',
|
||||
description: 'An opportunity',
|
||||
icon: 'IconTargetArrow',
|
||||
targetTableName: 'DEPRECATED',
|
||||
isCustom: false,
|
||||
isRemote: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isAuditLogged: true,
|
||||
isSearchable: true,
|
||||
labelIdentifierFieldMetadataId: '20202020-c2f1-4435-adca-22931f8b41b6',
|
||||
imageIdentifierFieldMetadataId: null,
|
||||
workspaceId,
|
||||
indexMetadatas: [],
|
||||
fieldsById: {
|
||||
'20202020-c2f1-4435-adca-22931f8b41b6': getMockFieldMetadataEntity({
|
||||
id: '20202020-c2f1-4435-adca-22931f8b41b6',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
defaultValue: "''",
|
||||
description: 'The opportunity name',
|
||||
icon: 'IconTargetArrow',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-5eef-417a-b517-ebeedaa8e10b': getMockFieldMetadataEntity({
|
||||
id: '20202020-5eef-417a-b517-ebeedaa8e10b',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.CURRENCY,
|
||||
name: 'amount',
|
||||
label: 'Amount',
|
||||
defaultValue: { amountMicros: null, currencyCode: "''" },
|
||||
description: 'Opportunity amount',
|
||||
icon: 'IconCurrencyDollar',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-597c-44d3-98ec-ea71aea5256b': getMockFieldMetadataEntity({
|
||||
id: '20202020-597c-44d3-98ec-ea71aea5256b',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
name: 'closeDate',
|
||||
label: 'Close date',
|
||||
defaultValue: null,
|
||||
description: 'Opportunity close date',
|
||||
icon: 'IconCalendarEvent',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-9b94-454a-94ca-8afb09c68faf': getMockFieldMetadataEntity({
|
||||
id: '20202020-9b94-454a-94ca-8afb09c68faf',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.SELECT,
|
||||
name: 'stage',
|
||||
label: 'Stage',
|
||||
defaultValue: "'NEW'",
|
||||
description: 'Opportunity stage',
|
||||
icon: 'IconProgressCheck',
|
||||
options: [
|
||||
{
|
||||
id: '20202020-dba8-4975-81bd-b29a41c0a387',
|
||||
color: 'red',
|
||||
label: 'New',
|
||||
value: 'NEW',
|
||||
position: 0,
|
||||
export const OPPORTUNITY_WITH_FIELDS_MAPS =
|
||||
getMockObjectMetadataItemWithFieldsMaps({
|
||||
id: objectMetadataId,
|
||||
nameSingular: 'opportunity',
|
||||
namePlural: 'opportunities',
|
||||
labelSingular: 'Opportunity',
|
||||
labelPlural: 'Opportunities',
|
||||
description: 'An opportunity',
|
||||
icon: 'IconTargetArrow',
|
||||
targetTableName: 'DEPRECATED',
|
||||
isCustom: false,
|
||||
isRemote: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isAuditLogged: true,
|
||||
isSearchable: true,
|
||||
labelIdentifierFieldMetadataId: '20202020-c2f1-4435-adca-22931f8b41b6',
|
||||
imageIdentifierFieldMetadataId: null,
|
||||
workspaceId,
|
||||
indexMetadatas: [],
|
||||
fieldsById: {
|
||||
'20202020-c2f1-4435-adca-22931f8b41b6': getMockFieldMetadataEntity({
|
||||
id: '20202020-c2f1-4435-adca-22931f8b41b6',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
defaultValue: "''",
|
||||
description: 'The opportunity name',
|
||||
icon: 'IconTargetArrow',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-5eef-417a-b517-ebeedaa8e10b': getMockFieldMetadataEntity({
|
||||
id: '20202020-5eef-417a-b517-ebeedaa8e10b',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.CURRENCY,
|
||||
name: 'amount',
|
||||
label: 'Amount',
|
||||
defaultValue: { amountMicros: null, currencyCode: "''" },
|
||||
description: 'Opportunity amount',
|
||||
icon: 'IconCurrencyDollar',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-597c-44d3-98ec-ea71aea5256b': getMockFieldMetadataEntity({
|
||||
id: '20202020-597c-44d3-98ec-ea71aea5256b',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
name: 'closeDate',
|
||||
label: 'Close date',
|
||||
defaultValue: null,
|
||||
description: 'Opportunity close date',
|
||||
icon: 'IconCalendarEvent',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-9b94-454a-94ca-8afb09c68faf': getMockFieldMetadataEntity({
|
||||
id: '20202020-9b94-454a-94ca-8afb09c68faf',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.SELECT,
|
||||
name: 'stage',
|
||||
label: 'Stage',
|
||||
defaultValue: "'NEW'",
|
||||
description: 'Opportunity stage',
|
||||
icon: 'IconProgressCheck',
|
||||
options: [
|
||||
{
|
||||
id: '20202020-dba8-4975-81bd-b29a41c0a387',
|
||||
color: 'red',
|
||||
label: 'New',
|
||||
value: 'NEW',
|
||||
position: 0,
|
||||
},
|
||||
{
|
||||
id: '20202020-1c9d-490c-940c-bf47addcd6a1',
|
||||
color: 'purple',
|
||||
label: 'Screening',
|
||||
value: 'SCREENING',
|
||||
position: 1,
|
||||
},
|
||||
{
|
||||
id: '20202020-1368-438b-8702-6d5e5727a888',
|
||||
color: 'sky',
|
||||
label: 'Meeting',
|
||||
value: 'MEETING',
|
||||
position: 2,
|
||||
},
|
||||
{
|
||||
id: '20202020-41e4-4b4e-a038-f02645f55767',
|
||||
color: 'turquoise',
|
||||
label: 'Proposal',
|
||||
value: 'PROPOSAL',
|
||||
position: 3,
|
||||
},
|
||||
{
|
||||
id: '20202020-8acf-4934-8519-42f7c9133cd5',
|
||||
color: 'yellow',
|
||||
label: 'Customer',
|
||||
value: 'CUSTOMER',
|
||||
position: 4,
|
||||
},
|
||||
],
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-30a5-4d8e-9b93-12d31ece0aaa': getMockFieldMetadataEntity({
|
||||
id: '20202020-30a5-4d8e-9b93-12d31ece0aaa',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.POSITION,
|
||||
name: 'position',
|
||||
label: 'Position',
|
||||
defaultValue: 0,
|
||||
description: 'Opportunity record position',
|
||||
icon: 'IconHierarchy2',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: true,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-f95f-424f-ab32-65961e8e9635': getMockFieldMetadataEntity({
|
||||
id: '20202020-f95f-424f-ab32-65961e8e9635',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.ACTOR,
|
||||
name: 'createdBy',
|
||||
label: 'Created by',
|
||||
defaultValue: { name: "'System'", source: "'MANUAL'" },
|
||||
description: 'The creator of the record',
|
||||
icon: 'IconCreativeCommonsSa',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-5e10-4780-babb-38a465ac546c': getMockFieldMetadataEntity({
|
||||
id: '20202020-5e10-4780-babb-38a465ac546c',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'searchVector',
|
||||
label: 'Search vector',
|
||||
defaultValue: null,
|
||||
description: 'Field used for full-text search',
|
||||
icon: 'IconUser',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: true,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-8f4a-4f8d-822e-90fe72f75b79': getMockFieldMetadataEntity({
|
||||
id: '20202020-8f4a-4f8d-822e-90fe72f75b79',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.UUID,
|
||||
name: 'id',
|
||||
label: 'Id',
|
||||
defaultValue: 'uuid',
|
||||
description: 'Id',
|
||||
icon: 'Icon123',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: true,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-f120-4b59-b239-f7f1d8eb243e': getMockFieldMetadataEntity({
|
||||
id: '20202020-f120-4b59-b239-f7f1d8eb243e',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
name: 'createdAt',
|
||||
label: 'Creation date',
|
||||
defaultValue: 'now',
|
||||
description: 'Creation date',
|
||||
icon: 'IconCalendar',
|
||||
settings: { displayFormat: DateDisplayFormat.RELATIVE },
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: false,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-dcc8-4318-9756-b87377692561': getMockFieldMetadataEntity({
|
||||
id: '20202020-dcc8-4318-9756-b87377692561',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
name: 'updatedAt',
|
||||
label: 'Last update',
|
||||
defaultValue: 'now',
|
||||
description: 'Last time the record was changed',
|
||||
icon: 'IconCalendarClock',
|
||||
settings: { displayFormat: DateDisplayFormat.RELATIVE },
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: false,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-1694-4f8b-8760-61a5ff330022': getMockFieldMetadataEntity({
|
||||
id: '20202020-1694-4f8b-8760-61a5ff330022',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
name: 'deletedAt',
|
||||
label: 'Deletion date',
|
||||
defaultValue: null,
|
||||
description: 'Record deletion date',
|
||||
icon: 'IconCalendarOff',
|
||||
settings: { displayFormat: DateDisplayFormat.RELATIVE },
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: false,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-4f52-4dea-a116-723f9bf7f082': getMockFieldMetadataEntity({
|
||||
id: '20202020-4f52-4dea-a116-723f9bf7f082',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'pointOfContact',
|
||||
label: 'Point of Contact',
|
||||
defaultValue: null,
|
||||
description: 'The point of contact for this opportunity',
|
||||
icon: 'IconUser',
|
||||
settings: {
|
||||
relationType: RelationType.MANY_TO_ONE,
|
||||
joinColumnName: 'pointOfContactId',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
{
|
||||
id: '20202020-1c9d-490c-940c-bf47addcd6a1',
|
||||
color: 'purple',
|
||||
label: 'Screening',
|
||||
value: 'SCREENING',
|
||||
position: 1,
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-fc02-4be2-be1a-e121daf5400d': getMockFieldMetadataEntity({
|
||||
id: '20202020-fc02-4be2-be1a-e121daf5400d',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'company',
|
||||
label: 'Company',
|
||||
defaultValue: null,
|
||||
description: 'The company this opportunity is associated with',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
settings: {
|
||||
relationType: RelationType.MANY_TO_ONE,
|
||||
joinColumnName: 'companyId',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
{
|
||||
id: '20202020-1368-438b-8702-6d5e5727a888',
|
||||
color: 'sky',
|
||||
label: 'Meeting',
|
||||
value: 'MEETING',
|
||||
position: 2,
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-fd9f-48f0-bd5f-5b0fec6a5de4': getMockFieldMetadataEntity({
|
||||
id: '20202020-fd9f-48f0-bd5f-5b0fec6a5de4',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'favorites',
|
||||
label: 'Favorites',
|
||||
defaultValue: null,
|
||||
description: 'Users who favorited this opportunity',
|
||||
icon: 'IconStar',
|
||||
settings: {
|
||||
relationType: RelationType.ONE_TO_MANY,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
{
|
||||
id: '20202020-41e4-4b4e-a038-f02645f55767',
|
||||
color: 'turquoise',
|
||||
label: 'Proposal',
|
||||
value: 'PROPOSAL',
|
||||
position: 3,
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-88ab-4138-98ce-80533bb423e3': getMockFieldMetadataEntity({
|
||||
id: '20202020-88ab-4138-98ce-80533bb423e3',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'taskTargets',
|
||||
label: 'Task Targets',
|
||||
defaultValue: null,
|
||||
description: 'Tasks targeting this opportunity',
|
||||
icon: 'IconCheckbox',
|
||||
settings: {
|
||||
relationType: RelationType.ONE_TO_MANY,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
{
|
||||
id: '20202020-8acf-4934-8519-42f7c9133cd5',
|
||||
color: 'yellow',
|
||||
label: 'Customer',
|
||||
value: 'CUSTOMER',
|
||||
position: 4,
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-4258-422b-b35b-db3f090af8da': getMockFieldMetadataEntity({
|
||||
id: '20202020-4258-422b-b35b-db3f090af8da',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'noteTargets',
|
||||
label: 'Note Targets',
|
||||
defaultValue: null,
|
||||
description: 'Notes targeting this opportunity',
|
||||
icon: 'IconNotes',
|
||||
settings: {
|
||||
relationType: RelationType.ONE_TO_MANY,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
],
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-30a5-4d8e-9b93-12d31ece0aaa': getMockFieldMetadataEntity({
|
||||
id: '20202020-30a5-4d8e-9b93-12d31ece0aaa',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.POSITION,
|
||||
name: 'position',
|
||||
label: 'Position',
|
||||
defaultValue: 0,
|
||||
description: 'Opportunity record position',
|
||||
icon: 'IconHierarchy2',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: true,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-f95f-424f-ab32-65961e8e9635': getMockFieldMetadataEntity({
|
||||
id: '20202020-f95f-424f-ab32-65961e8e9635',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.ACTOR,
|
||||
name: 'createdBy',
|
||||
label: 'Created by',
|
||||
defaultValue: { name: "'System'", source: "'MANUAL'" },
|
||||
description: 'The creator of the record',
|
||||
icon: 'IconCreativeCommonsSa',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-5e10-4780-babb-38a465ac546c': getMockFieldMetadataEntity({
|
||||
id: '20202020-5e10-4780-babb-38a465ac546c',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'searchVector',
|
||||
label: 'Search vector',
|
||||
defaultValue: null,
|
||||
description: 'Field used for full-text search',
|
||||
icon: 'IconUser',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: true,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-8f4a-4f8d-822e-90fe72f75b79': getMockFieldMetadataEntity({
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-16ca-40a7-a1ba-712975c916cd': getMockFieldMetadataEntity({
|
||||
id: '20202020-16ca-40a7-a1ba-712975c916cd',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'attachments',
|
||||
label: 'Attachments',
|
||||
defaultValue: null,
|
||||
description: 'Attachments for this opportunity',
|
||||
icon: 'IconPaperclip',
|
||||
settings: {
|
||||
relationType: RelationType.ONE_TO_MANY,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-92a5-47bf-a38d-c1c72b2c3e4d': getMockFieldMetadataEntity({
|
||||
id: '20202020-92a5-47bf-a38d-c1c72b2c3e4d',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'timelineActivities',
|
||||
label: 'Timeline Activities',
|
||||
defaultValue: null,
|
||||
description: 'Timeline activities for this opportunity',
|
||||
icon: 'IconTimeline',
|
||||
settings: {
|
||||
relationType: RelationType.ONE_TO_MANY,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
},
|
||||
fieldIdByName: {
|
||||
name: '20202020-c2f1-4435-adca-22931f8b41b6',
|
||||
amount: '20202020-5eef-417a-b517-ebeedaa8e10b',
|
||||
closeDate: '20202020-597c-44d3-98ec-ea71aea5256b',
|
||||
stage: '20202020-9b94-454a-94ca-8afb09c68faf',
|
||||
position: '20202020-30a5-4d8e-9b93-12d31ece0aaa',
|
||||
createdBy: '20202020-f95f-424f-ab32-65961e8e9635',
|
||||
searchVector: '20202020-5e10-4780-babb-38a465ac546c',
|
||||
id: '20202020-8f4a-4f8d-822e-90fe72f75b79',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.UUID,
|
||||
name: 'id',
|
||||
label: 'Id',
|
||||
defaultValue: 'uuid',
|
||||
description: 'Id',
|
||||
icon: 'Icon123',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: true,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-f120-4b59-b239-f7f1d8eb243e': getMockFieldMetadataEntity({
|
||||
id: '20202020-f120-4b59-b239-f7f1d8eb243e',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
name: 'createdAt',
|
||||
label: 'Creation date',
|
||||
defaultValue: 'now',
|
||||
description: 'Creation date',
|
||||
icon: 'IconCalendar',
|
||||
settings: { displayFormat: DateDisplayFormat.RELATIVE },
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: false,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-dcc8-4318-9756-b87377692561': getMockFieldMetadataEntity({
|
||||
id: '20202020-dcc8-4318-9756-b87377692561',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
name: 'updatedAt',
|
||||
label: 'Last update',
|
||||
defaultValue: 'now',
|
||||
description: 'Last time the record was changed',
|
||||
icon: 'IconCalendarClock',
|
||||
settings: { displayFormat: DateDisplayFormat.RELATIVE },
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: false,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: false,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-1694-4f8b-8760-61a5ff330022': getMockFieldMetadataEntity({
|
||||
id: '20202020-1694-4f8b-8760-61a5ff330022',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
name: 'deletedAt',
|
||||
label: 'Deletion date',
|
||||
defaultValue: null,
|
||||
description: 'Record deletion date',
|
||||
icon: 'IconCalendarOff',
|
||||
settings: { displayFormat: DateDisplayFormat.RELATIVE },
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: false,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-4f52-4dea-a116-723f9bf7f082': getMockFieldMetadataEntity({
|
||||
id: '20202020-4f52-4dea-a116-723f9bf7f082',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'pointOfContact',
|
||||
label: 'Point of Contact',
|
||||
defaultValue: null,
|
||||
description: 'The point of contact for this opportunity',
|
||||
icon: 'IconUser',
|
||||
settings: {
|
||||
relationType: RelationType.MANY_TO_ONE,
|
||||
joinColumnName: 'pointOfContactId',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-fc02-4be2-be1a-e121daf5400d': getMockFieldMetadataEntity({
|
||||
id: '20202020-fc02-4be2-be1a-e121daf5400d',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'company',
|
||||
label: 'Company',
|
||||
defaultValue: null,
|
||||
description: 'The company this opportunity is associated with',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
settings: {
|
||||
relationType: RelationType.MANY_TO_ONE,
|
||||
joinColumnName: 'companyId',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-fd9f-48f0-bd5f-5b0fec6a5de4': getMockFieldMetadataEntity({
|
||||
id: '20202020-fd9f-48f0-bd5f-5b0fec6a5de4',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'favorites',
|
||||
label: 'Favorites',
|
||||
defaultValue: null,
|
||||
description: 'Users who favorited this opportunity',
|
||||
icon: 'IconStar',
|
||||
settings: {
|
||||
relationType: RelationType.ONE_TO_MANY,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-88ab-4138-98ce-80533bb423e3': getMockFieldMetadataEntity({
|
||||
id: '20202020-88ab-4138-98ce-80533bb423e3',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'taskTargets',
|
||||
label: 'Task Targets',
|
||||
defaultValue: null,
|
||||
description: 'Tasks targeting this opportunity',
|
||||
icon: 'IconCheckbox',
|
||||
settings: {
|
||||
relationType: RelationType.ONE_TO_MANY,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-4258-422b-b35b-db3f090af8da': getMockFieldMetadataEntity({
|
||||
id: '20202020-4258-422b-b35b-db3f090af8da',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'noteTargets',
|
||||
label: 'Note Targets',
|
||||
defaultValue: null,
|
||||
description: 'Notes targeting this opportunity',
|
||||
icon: 'IconNotes',
|
||||
settings: {
|
||||
relationType: RelationType.ONE_TO_MANY,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-16ca-40a7-a1ba-712975c916cd': getMockFieldMetadataEntity({
|
||||
id: '20202020-16ca-40a7-a1ba-712975c916cd',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'attachments',
|
||||
label: 'Attachments',
|
||||
defaultValue: null,
|
||||
description: 'Attachments for this opportunity',
|
||||
icon: 'IconPaperclip',
|
||||
settings: {
|
||||
relationType: RelationType.ONE_TO_MANY,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
'20202020-92a5-47bf-a38d-c1c72b2c3e4d': getMockFieldMetadataEntity({
|
||||
id: '20202020-92a5-47bf-a38d-c1c72b2c3e4d',
|
||||
workspaceId,
|
||||
objectMetadataId,
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'timelineActivities',
|
||||
label: 'Timeline Activities',
|
||||
defaultValue: null,
|
||||
description: 'Timeline activities for this opportunity',
|
||||
icon: 'IconTimeline',
|
||||
settings: {
|
||||
relationType: RelationType.ONE_TO_MANY,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
},
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
isLabelSyncedWithName: true,
|
||||
createdAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
updatedAt: new Date('2025-06-27T12:55:13.271Z'),
|
||||
}) as FieldMetadataEntity,
|
||||
},
|
||||
fieldIdByName: {
|
||||
name: '20202020-c2f1-4435-adca-22931f8b41b6',
|
||||
amount: '20202020-5eef-417a-b517-ebeedaa8e10b',
|
||||
closeDate: '20202020-597c-44d3-98ec-ea71aea5256b',
|
||||
stage: '20202020-9b94-454a-94ca-8afb09c68faf',
|
||||
position: '20202020-30a5-4d8e-9b93-12d31ece0aaa',
|
||||
createdBy: '20202020-f95f-424f-ab32-65961e8e9635',
|
||||
searchVector: '20202020-5e10-4780-babb-38a465ac546c',
|
||||
id: '20202020-8f4a-4f8d-822e-90fe72f75b79',
|
||||
createdAt: '20202020-f120-4b59-b239-f7f1d8eb243e',
|
||||
updatedAt: '20202020-dcc8-4318-9756-b87377692561',
|
||||
deletedAt: '20202020-1694-4f8b-8760-61a5ff330022',
|
||||
pointOfContact: '20202020-4f52-4dea-a116-723f9bf7f082',
|
||||
company: '20202020-fc02-4be2-be1a-e121daf5400d',
|
||||
favorites: '20202020-fd9f-48f0-bd5f-5b0fec6a5de4',
|
||||
taskTargets: '20202020-88ab-4138-98ce-80533bb423e3',
|
||||
noteTargets: '20202020-4258-422b-b35b-db3f090af8da',
|
||||
attachments: '20202020-16ca-40a7-a1ba-712975c916cd',
|
||||
timelineActivities: '20202020-92a5-47bf-a38d-c1c72b2c3e4d',
|
||||
},
|
||||
fieldIdByJoinColumnName: {
|
||||
pointOfContactId: '20202020-4f52-4dea-a116-723f9bf7f082',
|
||||
companyId: '20202020-fc02-4be2-be1a-e121daf5400d',
|
||||
},
|
||||
} as const satisfies ObjectMetadataItemWithFieldMaps;
|
||||
createdAt: '20202020-f120-4b59-b239-f7f1d8eb243e',
|
||||
updatedAt: '20202020-dcc8-4318-9756-b87377692561',
|
||||
deletedAt: '20202020-1694-4f8b-8760-61a5ff330022',
|
||||
pointOfContact: '20202020-4f52-4dea-a116-723f9bf7f082',
|
||||
company: '20202020-fc02-4be2-be1a-e121daf5400d',
|
||||
favorites: '20202020-fd9f-48f0-bd5f-5b0fec6a5de4',
|
||||
taskTargets: '20202020-88ab-4138-98ce-80533bb423e3',
|
||||
noteTargets: '20202020-4258-422b-b35b-db3f090af8da',
|
||||
attachments: '20202020-16ca-40a7-a1ba-712975c916cd',
|
||||
timelineActivities: '20202020-92a5-47bf-a38d-c1c72b2c3e4d',
|
||||
},
|
||||
fieldIdByJoinColumnName: {
|
||||
pointOfContactId: '20202020-4f52-4dea-a116-723f9bf7f082',
|
||||
companyId: '20202020-fc02-4be2-be1a-e121daf5400d',
|
||||
},
|
||||
});
|
||||
|
||||
@ -5,71 +5,72 @@ import { OrderByDirection } from 'src/engine/api/graphql/workspace-query-builder
|
||||
import { GraphqlQueryRunnerException } from 'src/engine/api/graphql/graphql-query-runner/errors/graphql-query-runner.exception';
|
||||
import { computeCursorArgFilter } from 'src/engine/api/utils/compute-cursor-arg-filter.utils';
|
||||
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||
import { ObjectMetadataItemWithFieldMaps } from 'src/engine/metadata-modules/types/object-metadata-item-with-field-maps';
|
||||
import { getMockFieldMetadataEntity } from 'src/utils/__test__/get-field-metadata-entity.mock';
|
||||
import { getMockObjectMetadataItemWithFieldsMaps } from 'src/utils/__test__/get-object-metadata-item-with-fields-maps.mock';
|
||||
|
||||
describe('computeCursorArgFilter', () => {
|
||||
const objectMetadataItemWithFieldMaps = {
|
||||
id: 'object-id',
|
||||
workspaceId: 'workspace-id',
|
||||
nameSingular: 'person',
|
||||
namePlural: 'people',
|
||||
isCustom: false,
|
||||
isRemote: false,
|
||||
labelSingular: 'Person',
|
||||
labelPlural: 'People',
|
||||
targetTableName: 'person',
|
||||
indexMetadatas: [],
|
||||
isSystem: false,
|
||||
isActive: true,
|
||||
isAuditLogged: false,
|
||||
isSearchable: false,
|
||||
fieldIdByJoinColumnName: {},
|
||||
icon: 'Icon123',
|
||||
fieldIdByName: {
|
||||
name: 'name-id',
|
||||
age: 'age-id',
|
||||
fullName: 'fullname-id',
|
||||
},
|
||||
fieldsById: {
|
||||
'name-id': getMockFieldMetadataEntity({
|
||||
workspaceId: 'workspace-id',
|
||||
objectMetadataId: 'object-id',
|
||||
id: 'name-id',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
isLabelSyncedWithName: true,
|
||||
isNullable: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
'age-id': getMockFieldMetadataEntity({
|
||||
workspaceId: 'workspace-id',
|
||||
objectMetadataId: 'object-id',
|
||||
id: 'age-id',
|
||||
type: FieldMetadataType.NUMBER,
|
||||
name: 'age',
|
||||
label: 'Age',
|
||||
isLabelSyncedWithName: true,
|
||||
isNullable: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
'fullname-id': getMockFieldMetadataEntity({
|
||||
workspaceId: 'workspace-id',
|
||||
objectMetadataId: 'object-id',
|
||||
id: 'fullname-id',
|
||||
type: FieldMetadataType.FULL_NAME,
|
||||
name: 'fullName',
|
||||
label: 'Full Name',
|
||||
isLabelSyncedWithName: true,
|
||||
isNullable: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
},
|
||||
} satisfies ObjectMetadataItemWithFieldMaps;
|
||||
const objectMetadataItemWithFieldMaps =
|
||||
getMockObjectMetadataItemWithFieldsMaps({
|
||||
id: 'object-id',
|
||||
workspaceId: 'workspace-id',
|
||||
nameSingular: 'person',
|
||||
namePlural: 'people',
|
||||
isCustom: false,
|
||||
isRemote: false,
|
||||
labelSingular: 'Person',
|
||||
labelPlural: 'People',
|
||||
targetTableName: 'person',
|
||||
indexMetadatas: [],
|
||||
isSystem: false,
|
||||
isActive: true,
|
||||
isAuditLogged: false,
|
||||
isSearchable: false,
|
||||
fieldIdByJoinColumnName: {},
|
||||
icon: 'Icon123',
|
||||
fieldIdByName: {
|
||||
name: 'name-id',
|
||||
age: 'age-id',
|
||||
fullName: 'fullname-id',
|
||||
},
|
||||
fieldsById: {
|
||||
'name-id': getMockFieldMetadataEntity({
|
||||
workspaceId: 'workspace-id',
|
||||
objectMetadataId: 'object-id',
|
||||
id: 'name-id',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
isLabelSyncedWithName: true,
|
||||
isNullable: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
'age-id': getMockFieldMetadataEntity({
|
||||
workspaceId: 'workspace-id',
|
||||
objectMetadataId: 'object-id',
|
||||
id: 'age-id',
|
||||
type: FieldMetadataType.NUMBER,
|
||||
name: 'age',
|
||||
label: 'Age',
|
||||
isLabelSyncedWithName: true,
|
||||
isNullable: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
'fullname-id': getMockFieldMetadataEntity({
|
||||
workspaceId: 'workspace-id',
|
||||
objectMetadataId: 'object-id',
|
||||
id: 'fullname-id',
|
||||
type: FieldMetadataType.FULL_NAME,
|
||||
name: 'fullName',
|
||||
label: 'Full Name',
|
||||
isLabelSyncedWithName: true,
|
||||
isNullable: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
}) as FieldMetadataEntity,
|
||||
},
|
||||
});
|
||||
|
||||
describe('basic cursor filtering', () => {
|
||||
it('should return empty array when cursor is empty', () => {
|
||||
|
||||
Reference in New Issue
Block a user