Remove sync-metadata and IS_WORKSPACE_CREATION_V2_ENABLED feature flag (#16997)
# Introduction Followup of https://github.com/twentyhq/twenty/pull/17001#pullrequestreview-3638508738 close https://github.com/twentyhq/core-team-issues/issues/1910 We've completely decom the `sync-metadata` in production. We're now then removing its implementation in favor of the v2. ## TODO: - [x] Remove sync-metadata implem and commands - [x] Remove workspace decorators - [x] Type each deprecated field to deprecated on their workspaceEntity - [x] Remove the `workspace-sync-metadata` folder entirely - [x] remove workspace migration - [x] workspace migration removal migration - [x] remove the `v2` references from workspace manager file names - [x] remove the `v2` references from workspace manager modules - [ ] Double check impact on translation file path updates ## Note - Removed the gate logic - Remains some service v2 naming, serverless needs to be migrated on v2 fully - Removed workspaceMigration service app health consumption, making it always returning up ( no more down ) cc @FelixMalfait ( quite obsolete health check now, will require complete refactor once we introduce inter app dependency etc )
This commit is contained in:
+5
-88
@@ -1,96 +1,13 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { FieldMetadataType, RelationOnDeleteAction } from 'twenty-shared/types';
|
||||
|
||||
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
|
||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||
|
||||
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator';
|
||||
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||
import { WorkspaceIsFieldUIReadOnly } from 'src/engine/twenty-orm/decorators/workspace-is-field-ui-readonly.decorator';
|
||||
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||
import { WorkspaceJoinColumn } from 'src/engine/twenty-orm/decorators/workspace-join-column.decorator';
|
||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||
import { CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_ICONS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-icons';
|
||||
import { CalendarChannelWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity';
|
||||
import { CalendarEventWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-event.workspace-entity';
|
||||
import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface';
|
||||
import { type CalendarChannelWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity';
|
||||
import { type CalendarEventWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-event.workspace-entity';
|
||||
|
||||
@WorkspaceEntity({
|
||||
standardId: STANDARD_OBJECT_IDS.calendarChannelEventAssociation,
|
||||
|
||||
namePlural: 'calendarChannelEventAssociations',
|
||||
labelSingular: msg`Calendar Channel Event Association`,
|
||||
labelPlural: msg`Calendar Channel Event Associations`,
|
||||
description: msg`Calendar Channel Event Associations`,
|
||||
icon: STANDARD_OBJECT_ICONS.calendarChannelEventAssociation,
|
||||
})
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceIsNotAuditLogged()
|
||||
export class CalendarChannelEventAssociationWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
/**
|
||||
* External ID of the calendar event. Comes from the provider's API, is unique per connected account.
|
||||
* Used by the provider to identify the event in their system.
|
||||
* So two External ID can be related to the same event sharing the same iCalUID.
|
||||
*/
|
||||
@WorkspaceField({
|
||||
standardId:
|
||||
CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS.eventExternalId,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Event external ID`,
|
||||
description: msg`Event external ID`,
|
||||
icon: 'IconCalendar',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
eventExternalId: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId:
|
||||
CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS.recurringEventExternalId,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Recurring Event ID`,
|
||||
description: msg`Recurring Event ID`,
|
||||
icon: 'IconHistory',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
recurringEventExternalId: string | null;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId:
|
||||
CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS.calendarChannel,
|
||||
type: RelationType.MANY_TO_ONE,
|
||||
label: msg`Channel ID`,
|
||||
description: msg`Channel ID`,
|
||||
icon: 'IconCalendar',
|
||||
inverseSideTarget: () => CalendarChannelWorkspaceEntity,
|
||||
inverseSideFieldKey: 'calendarChannelEventAssociations',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
calendarChannel: Relation<CalendarChannelWorkspaceEntity>;
|
||||
|
||||
@WorkspaceJoinColumn('calendarChannel')
|
||||
calendarChannel: EntityRelation<CalendarChannelWorkspaceEntity>;
|
||||
calendarChannelId: string;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId:
|
||||
CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS.calendarEvent,
|
||||
type: RelationType.MANY_TO_ONE,
|
||||
label: msg`Event ID`,
|
||||
description: msg`Event ID`,
|
||||
icon: 'IconCalendar',
|
||||
inverseSideTarget: () => CalendarEventWorkspaceEntity,
|
||||
inverseSideFieldKey: 'calendarChannelEventAssociations',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
calendarEvent: Relation<CalendarEventWorkspaceEntity>;
|
||||
|
||||
@WorkspaceJoinColumn('calendarEvent')
|
||||
calendarEvent: EntityRelation<CalendarEventWorkspaceEntity>;
|
||||
calendarEventId: string;
|
||||
}
|
||||
|
||||
+5
-292
@@ -1,25 +1,9 @@
|
||||
import { registerEnumType } from '@nestjs/graphql';
|
||||
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { FieldMetadataType, RelationOnDeleteAction } from 'twenty-shared/types';
|
||||
|
||||
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
|
||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||
|
||||
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator';
|
||||
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||
import { WorkspaceIsFieldUIReadOnly } from 'src/engine/twenty-orm/decorators/workspace-is-field-ui-readonly.decorator';
|
||||
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||
import { WorkspaceJoinColumn } from 'src/engine/twenty-orm/decorators/workspace-join-column.decorator';
|
||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||
import { CALENDAR_CHANNEL_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_ICONS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-icons';
|
||||
import { CalendarChannelEventAssociationWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel-event-association.workspace-entity';
|
||||
import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity';
|
||||
import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface';
|
||||
import { type CalendarChannelEventAssociationWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel-event-association.workspace-entity';
|
||||
import { type ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity';
|
||||
|
||||
export enum CalendarChannelVisibility {
|
||||
METADATA = 'METADATA',
|
||||
@@ -68,292 +52,21 @@ registerEnumType(CalendarChannelContactAutoCreationPolicy, {
|
||||
name: 'CalendarChannelContactAutoCreationPolicy',
|
||||
});
|
||||
|
||||
@WorkspaceEntity({
|
||||
standardId: STANDARD_OBJECT_IDS.calendarChannel,
|
||||
|
||||
namePlural: 'calendarChannels',
|
||||
labelSingular: msg`Calendar Channel`,
|
||||
labelPlural: msg`Calendar Channels`,
|
||||
description: msg`Calendar Channels`,
|
||||
icon: STANDARD_OBJECT_ICONS.calendarChannel,
|
||||
labelIdentifierStandardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.handle,
|
||||
})
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceIsNotAuditLogged()
|
||||
export class CalendarChannelWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.handle,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Handle`,
|
||||
description: msg`Handle`,
|
||||
icon: 'IconAt',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
handle: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.syncStatus,
|
||||
type: FieldMetadataType.SELECT,
|
||||
label: msg`Sync status`,
|
||||
description: msg`Sync status`,
|
||||
icon: 'IconStatusChange',
|
||||
options: [
|
||||
{
|
||||
value: CalendarChannelSyncStatus.ONGOING,
|
||||
label: 'Ongoing',
|
||||
position: 1,
|
||||
color: 'yellow',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelSyncStatus.NOT_SYNCED,
|
||||
label: 'Not Synced',
|
||||
position: 2,
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelSyncStatus.ACTIVE,
|
||||
label: 'Active',
|
||||
position: 3,
|
||||
color: 'green',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelSyncStatus.FAILED_INSUFFICIENT_PERMISSIONS,
|
||||
label: 'Failed Insufficient Permissions',
|
||||
position: 4,
|
||||
color: 'red',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelSyncStatus.FAILED_UNKNOWN,
|
||||
label: 'Failed Unknown',
|
||||
position: 5,
|
||||
color: 'red',
|
||||
},
|
||||
],
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
syncStatus: CalendarChannelSyncStatus | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.syncStage,
|
||||
type: FieldMetadataType.SELECT,
|
||||
label: msg`Sync stage`,
|
||||
description: msg`Sync stage`,
|
||||
icon: 'IconStatusChange',
|
||||
options: [
|
||||
{
|
||||
value: CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
label: 'Calendar event list fetch pending',
|
||||
position: 0,
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_SCHEDULED,
|
||||
label: 'Calendar event list fetch scheduled',
|
||||
position: 1,
|
||||
color: 'green',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_ONGOING,
|
||||
label: 'Calendar event list fetch ongoing',
|
||||
position: 2,
|
||||
color: 'orange',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelSyncStage.CALENDAR_EVENTS_IMPORT_PENDING,
|
||||
label: 'Calendar events import pending',
|
||||
position: 3,
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelSyncStage.CALENDAR_EVENTS_IMPORT_SCHEDULED,
|
||||
label: 'Calendar events import scheduled',
|
||||
position: 4,
|
||||
color: 'green',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelSyncStage.CALENDAR_EVENTS_IMPORT_ONGOING,
|
||||
label: 'Calendar events import ongoing',
|
||||
position: 5,
|
||||
color: 'orange',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelSyncStage.FAILED,
|
||||
label: 'Failed',
|
||||
position: 6,
|
||||
color: 'red',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelSyncStage.PENDING_CONFIGURATION,
|
||||
label: 'Pending configuration',
|
||||
position: 9,
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
defaultValue: `'${CalendarChannelSyncStage.PENDING_CONFIGURATION}'`,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
syncStage: CalendarChannelSyncStage;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.visibility,
|
||||
type: FieldMetadataType.SELECT,
|
||||
label: msg`Visibility`,
|
||||
description: msg`Visibility`,
|
||||
icon: 'IconEyeglass',
|
||||
options: [
|
||||
{
|
||||
value: CalendarChannelVisibility.METADATA,
|
||||
label: 'Metadata',
|
||||
position: 0,
|
||||
color: 'green',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelVisibility.SHARE_EVERYTHING,
|
||||
label: 'Share Everything',
|
||||
position: 1,
|
||||
color: 'orange',
|
||||
},
|
||||
],
|
||||
defaultValue: `'${CalendarChannelVisibility.SHARE_EVERYTHING}'`,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
visibility: string;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId:
|
||||
CALENDAR_CHANNEL_STANDARD_FIELD_IDS.isContactAutoCreationEnabled,
|
||||
type: FieldMetadataType.BOOLEAN,
|
||||
label: msg`Is Contact Auto Creation Enabled`,
|
||||
description: msg`Is Contact Auto Creation Enabled`,
|
||||
icon: 'IconUserCircle',
|
||||
defaultValue: true,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
isContactAutoCreationEnabled: boolean;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.contactAutoCreationPolicy,
|
||||
type: FieldMetadataType.SELECT,
|
||||
label: msg`Contact auto creation policy`,
|
||||
description: msg`Automatically create records for people you participated with in an event.`,
|
||||
icon: 'IconUserCircle',
|
||||
options: [
|
||||
{
|
||||
value:
|
||||
CalendarChannelContactAutoCreationPolicy.AS_PARTICIPANT_AND_ORGANIZER,
|
||||
label: 'As Participant and Organizer',
|
||||
color: 'green',
|
||||
position: 0,
|
||||
},
|
||||
{
|
||||
value: CalendarChannelContactAutoCreationPolicy.AS_PARTICIPANT,
|
||||
label: 'As Participant',
|
||||
color: 'orange',
|
||||
position: 1,
|
||||
},
|
||||
{
|
||||
value: CalendarChannelContactAutoCreationPolicy.AS_ORGANIZER,
|
||||
label: 'As Organizer',
|
||||
color: 'blue',
|
||||
position: 2,
|
||||
},
|
||||
{
|
||||
value: CalendarChannelContactAutoCreationPolicy.NONE,
|
||||
label: 'None',
|
||||
color: 'red',
|
||||
position: 3,
|
||||
},
|
||||
],
|
||||
defaultValue: `'${CalendarChannelContactAutoCreationPolicy.AS_PARTICIPANT_AND_ORGANIZER}'`,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
contactAutoCreationPolicy: CalendarChannelContactAutoCreationPolicy;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.isSyncEnabled,
|
||||
type: FieldMetadataType.BOOLEAN,
|
||||
label: msg`Is Sync Enabled`,
|
||||
description: msg`Is Sync Enabled`,
|
||||
icon: 'IconRefresh',
|
||||
defaultValue: true,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
isSyncEnabled: boolean;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.syncCursor,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Sync Cursor`,
|
||||
description: msg`Sync Cursor. Used for syncing events from the calendar provider`,
|
||||
icon: 'IconReload',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
syncCursor: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.syncedAt,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
label: msg`Last sync date`,
|
||||
description: msg`Last sync date`,
|
||||
icon: 'IconHistory',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
syncedAt: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.syncStageStartedAt,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
label: msg`Sync stage started at`,
|
||||
description: msg`Sync stage started at`,
|
||||
icon: 'IconHistory',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
syncStageStartedAt: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.throttleFailureCount,
|
||||
type: FieldMetadataType.NUMBER,
|
||||
label: msg`Throttle Failure Count`,
|
||||
description: msg`Throttle Failure Count`,
|
||||
icon: 'IconX',
|
||||
defaultValue: 0,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
throttleFailureCount: number;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.connectedAccount,
|
||||
type: RelationType.MANY_TO_ONE,
|
||||
label: msg`Connected Account`,
|
||||
description: msg`Connected Account`,
|
||||
icon: 'IconUserCircle',
|
||||
inverseSideTarget: () => ConnectedAccountWorkspaceEntity,
|
||||
inverseSideFieldKey: 'calendarChannels',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
connectedAccount: Relation<ConnectedAccountWorkspaceEntity>;
|
||||
|
||||
@WorkspaceJoinColumn('connectedAccount')
|
||||
connectedAccount: EntityRelation<ConnectedAccountWorkspaceEntity>;
|
||||
connectedAccountId: string;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId:
|
||||
CALENDAR_CHANNEL_STANDARD_FIELD_IDS.calendarChannelEventAssociations,
|
||||
type: RelationType.ONE_TO_MANY,
|
||||
label: msg`Calendar Channel Event Associations`,
|
||||
description: msg`Calendar Channel Event Associations`,
|
||||
icon: 'IconCalendar',
|
||||
inverseSideTarget: () => CalendarChannelEventAssociationWorkspaceEntity,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
calendarChannelEventAssociations: Relation<
|
||||
calendarChannelEventAssociations: EntityRelation<
|
||||
CalendarChannelEventAssociationWorkspaceEntity[]
|
||||
>;
|
||||
}
|
||||
|
||||
+7
-145
@@ -1,24 +1,8 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { FieldMetadataType, RelationOnDeleteAction } from 'twenty-shared/types';
|
||||
|
||||
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
|
||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||
|
||||
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator';
|
||||
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||
import { WorkspaceIsFieldUIReadOnly } from 'src/engine/twenty-orm/decorators/workspace-is-field-ui-readonly.decorator';
|
||||
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||
import { WorkspaceJoinColumn } from 'src/engine/twenty-orm/decorators/workspace-join-column.decorator';
|
||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||
import { CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_ICONS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-icons';
|
||||
import { CalendarEventWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-event.workspace-entity';
|
||||
import { PersonWorkspaceEntity } from 'src/modules/person/standard-objects/person.workspace-entity';
|
||||
import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity';
|
||||
import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface';
|
||||
import { type CalendarEventWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-event.workspace-entity';
|
||||
import { type PersonWorkspaceEntity } from 'src/modules/person/standard-objects/person.workspace-entity';
|
||||
import { type WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity';
|
||||
|
||||
export enum CalendarEventParticipantResponseStatus {
|
||||
NEEDS_ACTION = 'NEEDS_ACTION',
|
||||
@@ -27,137 +11,15 @@ export enum CalendarEventParticipantResponseStatus {
|
||||
ACCEPTED = 'ACCEPTED',
|
||||
}
|
||||
|
||||
@WorkspaceEntity({
|
||||
standardId: STANDARD_OBJECT_IDS.calendarEventParticipant,
|
||||
|
||||
namePlural: 'calendarEventParticipants',
|
||||
labelSingular: msg`Calendar event participant`,
|
||||
labelPlural: msg`Calendar event participants`,
|
||||
description: msg`Calendar event participants`,
|
||||
icon: STANDARD_OBJECT_ICONS.calendarEventParticipant,
|
||||
labelIdentifierStandardId:
|
||||
CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.handle,
|
||||
})
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceIsNotAuditLogged()
|
||||
export class CalendarEventParticipantWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.handle,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Handle`,
|
||||
description: msg`Handle`,
|
||||
icon: 'IconMail',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
handle: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.displayName,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Display Name`,
|
||||
description: msg`Display Name`,
|
||||
icon: 'IconUser',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
displayName: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.isOrganizer,
|
||||
type: FieldMetadataType.BOOLEAN,
|
||||
label: msg`Is Organizer`,
|
||||
description: msg`Is Organizer`,
|
||||
icon: 'IconUser',
|
||||
defaultValue: false,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
isOrganizer: boolean;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.responseStatus,
|
||||
type: FieldMetadataType.SELECT,
|
||||
label: msg`Response Status`,
|
||||
description: msg`Response Status`,
|
||||
icon: 'IconUser',
|
||||
options: [
|
||||
{
|
||||
value: CalendarEventParticipantResponseStatus.NEEDS_ACTION,
|
||||
label: 'Needs Action',
|
||||
position: 0,
|
||||
color: 'orange',
|
||||
},
|
||||
{
|
||||
value: CalendarEventParticipantResponseStatus.DECLINED,
|
||||
label: 'Declined',
|
||||
position: 1,
|
||||
color: 'red',
|
||||
},
|
||||
{
|
||||
value: CalendarEventParticipantResponseStatus.TENTATIVE,
|
||||
label: 'Tentative',
|
||||
position: 2,
|
||||
color: 'yellow',
|
||||
},
|
||||
{
|
||||
value: CalendarEventParticipantResponseStatus.ACCEPTED,
|
||||
label: 'Accepted',
|
||||
position: 3,
|
||||
color: 'green',
|
||||
},
|
||||
],
|
||||
defaultValue: `'${CalendarEventParticipantResponseStatus.NEEDS_ACTION}'`,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
responseStatus: string;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.calendarEvent,
|
||||
type: RelationType.MANY_TO_ONE,
|
||||
label: msg`Event ID`,
|
||||
description: msg`Event ID`,
|
||||
icon: 'IconCalendar',
|
||||
inverseSideTarget: () => CalendarEventWorkspaceEntity,
|
||||
inverseSideFieldKey: 'calendarEventParticipants',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
calendarEvent: Relation<CalendarEventWorkspaceEntity>;
|
||||
|
||||
@WorkspaceJoinColumn('calendarEvent')
|
||||
calendarEvent: EntityRelation<CalendarEventWorkspaceEntity>;
|
||||
calendarEventId: string;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.person,
|
||||
type: RelationType.MANY_TO_ONE,
|
||||
label: msg`Person`,
|
||||
description: msg`Person`,
|
||||
icon: 'IconUser',
|
||||
inverseSideTarget: () => PersonWorkspaceEntity,
|
||||
inverseSideFieldKey: 'calendarEventParticipants',
|
||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
person: Relation<PersonWorkspaceEntity> | null;
|
||||
|
||||
@WorkspaceJoinColumn('person')
|
||||
person: EntityRelation<PersonWorkspaceEntity> | null;
|
||||
personId: string | null;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.workspaceMember,
|
||||
type: RelationType.MANY_TO_ONE,
|
||||
label: msg`Workspace Member`,
|
||||
description: msg`Workspace Member`,
|
||||
icon: 'IconUser',
|
||||
inverseSideTarget: () => WorkspaceMemberWorkspaceEntity,
|
||||
inverseSideFieldKey: 'calendarEventParticipants',
|
||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
workspaceMember: Relation<WorkspaceMemberWorkspaceEntity> | null;
|
||||
|
||||
@WorkspaceJoinColumn('workspaceMember')
|
||||
workspaceMember: EntityRelation<WorkspaceMemberWorkspaceEntity> | null;
|
||||
workspaceMemberId: string | null;
|
||||
}
|
||||
|
||||
+6
-177
@@ -1,198 +1,27 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import {
|
||||
FieldMetadataType,
|
||||
LinksMetadata,
|
||||
RelationOnDeleteAction,
|
||||
} from 'twenty-shared/types';
|
||||
|
||||
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
|
||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||
import { type LinksMetadata } from 'twenty-shared/types';
|
||||
|
||||
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator';
|
||||
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||
import { WorkspaceIsFieldUIReadOnly } from 'src/engine/twenty-orm/decorators/workspace-is-field-ui-readonly.decorator';
|
||||
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||
import { CALENDAR_EVENT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_ICONS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-icons';
|
||||
import { CalendarChannelEventAssociationWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel-event-association.workspace-entity';
|
||||
import { CalendarEventParticipantWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-event-participant.workspace-entity';
|
||||
import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface';
|
||||
import { type CalendarChannelEventAssociationWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel-event-association.workspace-entity';
|
||||
import { type CalendarEventParticipantWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-event-participant.workspace-entity';
|
||||
|
||||
@WorkspaceEntity({
|
||||
standardId: STANDARD_OBJECT_IDS.calendarEvent,
|
||||
|
||||
namePlural: 'calendarEvents',
|
||||
labelSingular: msg`Calendar event`,
|
||||
labelPlural: msg`Calendar events`,
|
||||
description: msg`Calendar events`,
|
||||
icon: STANDARD_OBJECT_ICONS.calendarEvent,
|
||||
labelIdentifierStandardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.title,
|
||||
})
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceIsNotAuditLogged()
|
||||
export class CalendarEventWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.title,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Title`,
|
||||
description: msg`Title`,
|
||||
icon: 'IconH1',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
title: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.isCanceled,
|
||||
type: FieldMetadataType.BOOLEAN,
|
||||
label: msg`Is canceled`,
|
||||
description: msg`Is canceled`,
|
||||
icon: 'IconCalendarCancel',
|
||||
defaultValue: false,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
isCanceled: boolean;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.isFullDay,
|
||||
type: FieldMetadataType.BOOLEAN,
|
||||
label: msg`Is Full Day`,
|
||||
description: msg`Is Full Day`,
|
||||
icon: 'IconHours24',
|
||||
defaultValue: false,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
isFullDay: boolean;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.startsAt,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
label: msg`Start Date`,
|
||||
description: msg`Start Date`,
|
||||
icon: 'IconCalendarClock',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
startsAt: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.endsAt,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
label: msg`End Date`,
|
||||
description: msg`End Date`,
|
||||
icon: 'IconCalendarClock',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
endsAt: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.externalCreatedAt,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
label: msg`Creation DateTime`,
|
||||
description: msg`Creation DateTime`,
|
||||
icon: 'IconCalendarPlus',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
externalCreatedAt: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.externalUpdatedAt,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
label: msg`Update DateTime`,
|
||||
description: msg`Update DateTime`,
|
||||
icon: 'IconCalendarCog',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
externalUpdatedAt: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.description,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Description`,
|
||||
description: msg`Description`,
|
||||
icon: 'IconFileDescription',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
description: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.location,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Location`,
|
||||
description: msg`Location`,
|
||||
icon: 'IconMapPin',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
location: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.iCalUid,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`iCal UID`,
|
||||
description: msg`iCal UID`,
|
||||
icon: 'IconKey',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
iCalUid: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.conferenceSolution,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Conference Solution`,
|
||||
description: msg`Conference Solution`,
|
||||
icon: 'IconScreenShare',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
conferenceSolution: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.conferenceLink,
|
||||
type: FieldMetadataType.LINKS,
|
||||
label: msg`Meet Link`,
|
||||
description: msg`Meet Link`,
|
||||
icon: 'IconLink',
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
conferenceLink: LinksMetadata;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId:
|
||||
CALENDAR_EVENT_STANDARD_FIELD_IDS.calendarChannelEventAssociations,
|
||||
type: RelationType.ONE_TO_MANY,
|
||||
label: msg`Calendar Channel Event Associations`,
|
||||
description: msg`Calendar Channel Event Associations`,
|
||||
icon: 'IconCalendar',
|
||||
inverseSideTarget: () => CalendarChannelEventAssociationWorkspaceEntity,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
calendarChannelEventAssociations: Relation<
|
||||
calendarChannelEventAssociations: EntityRelation<
|
||||
CalendarChannelEventAssociationWorkspaceEntity[]
|
||||
>;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.calendarEventParticipants,
|
||||
type: RelationType.ONE_TO_MANY,
|
||||
label: msg`Event Participants`,
|
||||
description: msg`Event Participants`,
|
||||
icon: 'IconUserCircle',
|
||||
inverseSideTarget: () => CalendarEventParticipantWorkspaceEntity,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
calendarEventParticipants: Relation<
|
||||
calendarEventParticipants: EntityRelation<
|
||||
CalendarEventParticipantWorkspaceEntity[]
|
||||
>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user