feat: simplification of default-value specification in FieldMetadata (#4592)

* feat: wip refactor default-value

* feat: health check to migrate default value

* fix: tests

* fix: refactor defaultValue to make it more clean

* fix: unit tests

* fix: front-end default value
This commit is contained in:
Jérémy M
2024-03-27 10:56:04 +01:00
committed by GitHub
parent 90ce7709dd
commit 5c0b65eecb
43 changed files with 481 additions and 328 deletions

View File

@ -47,7 +47,7 @@ export class ActivityObjectMetadata extends BaseObjectMetadata {
label: 'Type',
description: 'Activity type',
icon: 'IconCheckbox',
defaultValue: { value: 'Note' },
defaultValue: "'Note'",
})
type: string;

View File

@ -72,7 +72,7 @@ export class CalendarChannelObjectMetadata extends BaseObjectMetadata {
color: 'orange',
},
],
defaultValue: { value: CalendarChannelVisibility.SHARE_EVERYTHING },
defaultValue: `'${CalendarChannelVisibility.SHARE_EVERYTHING}'`,
})
visibility: string;
@ -82,7 +82,7 @@ export class CalendarChannelObjectMetadata extends BaseObjectMetadata {
label: 'Is Contact Auto Creation Enabled',
description: 'Is Contact Auto Creation Enabled',
icon: 'IconUserCircle',
defaultValue: { value: true },
defaultValue: true,
})
isContactAutoCreationEnabled: boolean;
@ -92,7 +92,7 @@ export class CalendarChannelObjectMetadata extends BaseObjectMetadata {
label: 'Is Sync Enabled',
description: 'Is Sync Enabled',
icon: 'IconRefresh',
defaultValue: { value: true },
defaultValue: true,
})
isSyncEnabled: boolean;

View File

@ -100,7 +100,7 @@ export class CalendarEventAttendeeObjectMetadata extends BaseObjectMetadata {
color: 'green',
},
],
defaultValue: { value: CalendarEventAttendeeResponseStatus.NEEDS_ACTION },
defaultValue: `'${CalendarEventAttendeeResponseStatus.NEEDS_ACTION}'`,
})
responseStatus: string;

View File

@ -106,7 +106,7 @@ export class CompanyObjectMetadata extends BaseObjectMetadata {
description:
'Ideal Customer Profile: Indicates whether the company is the most suitable and valuable customer for you',
icon: 'IconTarget',
defaultValue: { value: false },
defaultValue: false,
})
idealCustomerProfile: boolean;

View File

@ -29,7 +29,7 @@ export class FavoriteObjectMetadata extends BaseObjectMetadata {
label: 'Position',
description: 'Favorite position',
icon: 'IconList',
defaultValue: { value: 0 },
defaultValue: 0,
})
position: number;

View File

@ -40,7 +40,7 @@ export class MessageChannelObjectMetadata extends BaseObjectMetadata {
color: 'orange',
},
],
defaultValue: { value: 'share_everything' },
defaultValue: "'share_everything'",
})
visibility: string;
@ -73,7 +73,7 @@ export class MessageChannelObjectMetadata extends BaseObjectMetadata {
{ value: 'email', label: 'Email', position: 0, color: 'green' },
{ value: 'sms', label: 'SMS', position: 1, color: 'blue' },
],
defaultValue: { value: 'email' },
defaultValue: "'email'",
})
type: string;
@ -83,7 +83,7 @@ export class MessageChannelObjectMetadata extends BaseObjectMetadata {
label: 'Is Contact Auto Creation Enabled',
description: 'Is Contact Auto Creation Enabled',
icon: 'IconUserCircle',
defaultValue: { value: true },
defaultValue: true,
})
isContactAutoCreationEnabled: boolean;

View File

@ -42,7 +42,7 @@ export class MessageParticipantObjectMetadata extends BaseObjectMetadata {
{ value: 'cc', label: 'Cc', position: 2, color: 'orange' },
{ value: 'bcc', label: 'Bcc', position: 3, color: 'red' },
],
defaultValue: { value: 'from' },
defaultValue: "'from'",
})
role: string;

View File

@ -55,7 +55,7 @@ export class MessageObjectMetadata extends BaseObjectMetadata {
{ value: 'incoming', label: 'Incoming', position: 0, color: 'green' },
{ value: 'outgoing', label: 'Outgoing', position: 1, color: 'blue' },
],
defaultValue: { value: 'incoming' },
defaultValue: "'incoming'",
})
direction: string;

View File

@ -63,7 +63,7 @@ export class OpportunityObjectMetadata extends BaseObjectMetadata {
label: 'Probability',
description: 'Opportunity probability',
icon: 'IconProgressCheck',
defaultValue: { value: '0' },
defaultValue: "'0'",
})
probability: string;
@ -85,7 +85,7 @@ export class OpportunityObjectMetadata extends BaseObjectMetadata {
},
{ value: 'CUSTOMER', label: 'Customer', position: 4, color: 'yellow' },
],
defaultValue: { value: 'NEW' },
defaultValue: "'NEW'",
})
stage: string;

View File

@ -33,7 +33,7 @@ export class ViewFieldObjectMetadata extends BaseObjectMetadata {
label: 'Visible',
description: 'View Field visibility',
icon: 'IconEye',
defaultValue: { value: true },
defaultValue: true,
})
isVisible: boolean;
@ -43,7 +43,7 @@ export class ViewFieldObjectMetadata extends BaseObjectMetadata {
label: 'Size',
description: 'View Field size',
icon: 'IconEye',
defaultValue: { value: 0 },
defaultValue: 0,
})
size: number;
@ -53,7 +53,7 @@ export class ViewFieldObjectMetadata extends BaseObjectMetadata {
label: 'Position',
description: 'View Field position',
icon: 'IconList',
defaultValue: { value: 0 },
defaultValue: 0,
})
position: number;

View File

@ -31,7 +31,7 @@ export class ViewFilterObjectMetadata extends BaseObjectMetadata {
type: FieldMetadataType.TEXT,
label: 'Operand',
description: 'View Filter operand',
defaultValue: { value: 'Contains' },
defaultValue: "'Contains'",
})
operand: string;

View File

@ -32,7 +32,7 @@ export class ViewSortObjectMetadata extends BaseObjectMetadata {
type: FieldMetadataType.TEXT,
label: 'Direction',
description: 'View Sort direction',
defaultValue: { value: 'asc' },
defaultValue: "'asc'",
})
direction: string;

View File

@ -43,7 +43,7 @@ export class ViewObjectMetadata extends BaseObjectMetadata {
type: FieldMetadataType.TEXT,
label: 'Type',
description: 'View type',
defaultValue: { value: 'table' },
defaultValue: "'table'",
})
type: string;
@ -53,7 +53,7 @@ export class ViewObjectMetadata extends BaseObjectMetadata {
label: 'Key',
description: 'View key',
options: [{ value: 'INDEX', label: 'Index', position: 0, color: 'red' }],
defaultValue: { value: 'INDEX' },
defaultValue: "'INDEX'",
})
@IsNullable()
key: string;
@ -88,7 +88,7 @@ export class ViewObjectMetadata extends BaseObjectMetadata {
type: FieldMetadataType.BOOLEAN,
label: 'Compact View',
description: 'Describes if the view is in compact mode',
defaultValue: { value: false },
defaultValue: false,
})
isCompact: boolean;

View File

@ -49,7 +49,7 @@ export class WorkspaceMemberObjectMetadata extends BaseObjectMetadata {
label: 'Color Scheme',
description: 'Preferred color scheme',
icon: 'IconColorSwatch',
defaultValue: { value: 'Light' },
defaultValue: "'Light'",
})
colorScheme: string;
@ -59,7 +59,7 @@ export class WorkspaceMemberObjectMetadata extends BaseObjectMetadata {
label: 'Language',
description: 'Preferred language',
icon: 'IconLanguage',
defaultValue: { value: 'en' },
defaultValue: "'en'",
})
locale: string;