4281 create calendarevent data model (#4317)

* create model

* update model

* remove webLink

* done

* fix namePlural case

* Delete packages/twenty-server/src/workspace/workspace-sync-metadata/standard-objects/calendar-event-attendee.object-metadata.ts

* updates after comments

* add enum
This commit is contained in:
bosiraphael
2024-03-05 17:50:07 +01:00
committed by GitHub
parent a7733b24df
commit 0d231902f0
4 changed files with 157 additions and 2 deletions

View File

@ -1,3 +1,4 @@
import { FeatureFlagKeys } from 'src/core/feature-flag/feature-flag.entity';
import { FieldMetadataType } from 'src/metadata/field-metadata/field-metadata.entity';
import { FieldMetadata } from 'src/workspace/workspace-sync-metadata/decorators/field-metadata.decorator';
import { Gate } from 'src/workspace/workspace-sync-metadata/decorators/gate.decorator';
@ -15,7 +16,7 @@ import { ConnectedAccountObjectMetadata } from 'src/workspace/workspace-sync-met
})
@IsSystem()
@Gate({
featureFlag: 'IS_CALENDAR_ENABLED',
featureFlag: FeatureFlagKeys.IsCalendarEnabled,
})
export class CalendarChannelObjectMetadata extends BaseObjectMetadata {
@FieldMetadata({

View File

@ -0,0 +1,151 @@
import { FeatureFlagKeys } from 'src/core/feature-flag/feature-flag.entity';
import { FieldMetadataType } from 'src/metadata/field-metadata/field-metadata.entity';
import { FieldMetadata } from 'src/workspace/workspace-sync-metadata/decorators/field-metadata.decorator';
import { Gate } from 'src/workspace/workspace-sync-metadata/decorators/gate.decorator';
import { IsSystem } from 'src/workspace/workspace-sync-metadata/decorators/is-system.decorator';
import { ObjectMetadata } from 'src/workspace/workspace-sync-metadata/decorators/object-metadata.decorator';
import { BaseObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/base.object-metadata';
export enum CalendarEventStatus {
CONFIRMED = 'CONFIRMED',
TENTATIVE = 'TENTATIVE',
CANCELED = 'CANCELED',
}
@ObjectMetadata({
namePlural: 'calendarEvents',
labelSingular: 'Calendar event',
labelPlural: 'Calendar events',
description: 'Calendar events',
icon: 'IconCalendar',
})
@IsSystem()
@Gate({
featureFlag: FeatureFlagKeys.IsCalendarEnabled,
})
export class CalendarEventObjectMetadata extends BaseObjectMetadata {
@FieldMetadata({
type: FieldMetadataType.TEXT,
label: 'Title',
description: 'Title',
icon: 'IconH1',
})
title: string;
@FieldMetadata({
type: FieldMetadataType.SELECT,
label: 'Status',
description: 'Status',
icon: 'IconCheckbox',
options: [
{
value: CalendarEventStatus.CONFIRMED,
label: 'Confirmed',
position: 0,
color: 'green',
},
{
value: CalendarEventStatus.TENTATIVE,
label: 'Tentative',
position: 1,
color: 'blue',
},
{
value: CalendarEventStatus.CANCELED,
label: 'Canceled',
position: 2,
color: 'red',
},
],
defaultValue: { value: CalendarEventStatus.CONFIRMED },
})
status: string;
@FieldMetadata({
type: FieldMetadataType.BOOLEAN,
label: 'Is Full Day',
description: 'Is Full Day',
icon: 'Icon24Hours',
})
isFullDay: boolean;
@FieldMetadata({
type: FieldMetadataType.DATE_TIME,
label: 'Start DateTime',
description: 'Start DateTime',
icon: 'IconCalendarClock',
})
startsAt: string;
@FieldMetadata({
type: FieldMetadataType.DATE_TIME,
label: 'End DateTime',
description: 'End DateTime',
icon: 'IconCalendarClock',
})
endsAt: string;
@FieldMetadata({
type: FieldMetadataType.DATE_TIME,
label: 'Creation DateTime',
description: 'Creation DateTime',
icon: 'IconCalendarPlus',
})
externalCreatedAt: string;
@FieldMetadata({
type: FieldMetadataType.DATE_TIME,
label: 'Update DateTime',
description: 'Update DateTime',
icon: 'IconCalendarCog',
})
externalUpdatedAt: string;
@FieldMetadata({
type: FieldMetadataType.TEXT,
label: 'Description',
description: 'Description',
icon: 'IconFileDescription',
})
description: string;
@FieldMetadata({
type: FieldMetadataType.TEXT,
label: 'Location',
description: 'Location',
icon: 'IconMapPin',
})
location: string;
@FieldMetadata({
type: FieldMetadataType.TEXT,
label: 'iCal UID',
description: 'iCal UID',
icon: 'IconKey',
})
iCalUID: string;
@FieldMetadata({
type: FieldMetadataType.TEXT,
label: 'Conference Solution',
description: 'Conference Solution',
icon: 'IconScreenShare',
})
conferenceSolution: string;
@FieldMetadata({
type: FieldMetadataType.TEXT,
label: 'Conference URI',
description: 'Conference URI',
icon: 'IconLink',
})
conferenceUri: string;
@FieldMetadata({
type: FieldMetadataType.TEXT,
label: 'Recurring Event ID',
description: 'Recurring Event ID',
icon: 'IconHistory',
})
recurringEventExternalId: string;
}

View File

@ -1,3 +1,4 @@
import { FeatureFlagKeys } from 'src/core/feature-flag/feature-flag.entity';
import { FieldMetadataType } from 'src/metadata/field-metadata/field-metadata.entity';
import {
RelationMetadataType,
@ -96,7 +97,7 @@ export class ConnectedAccountObjectMetadata extends BaseObjectMetadata {
onDelete: RelationOnDeleteAction.CASCADE,
})
@Gate({
featureFlag: 'IS_CALENDAR_ENABLED',
featureFlag: FeatureFlagKeys.IsCalendarEnabled,
})
calendarChannels: CalendarChannelObjectMetadata[];
}

View File

@ -3,6 +3,7 @@ import { ActivityObjectMetadata } from 'src/workspace/workspace-sync-metadata/st
import { ApiKeyObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/api-key.object-metadata';
import { AttachmentObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/attachment.object-metadata';
import { BlocklistObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/blocklist.object-metadata';
import { CalendarEventObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/calendar-event.object-metadata';
import { CalendarChannelObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/calendar-channel.object-metadata';
import { CommentObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/comment.object-metadata';
import { CompanyObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/company.object-metadata';
@ -47,5 +48,6 @@ export const standardObjectMetadataCollection = [
MessageChannelObjectMetadata,
MessageParticipantObjectMetadata,
MessageChannelMessageAssociationObjectMetadata,
CalendarEventObjectMetadata,
CalendarChannelObjectMetadata,
];