import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface'; import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator'; import { FeatureFlagKeys } from 'src/engine/core-modules/feature-flag/feature-flag.entity'; import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity'; import { RelationMetadataType, RelationOnDeleteAction, } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity'; import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator'; import { Gate } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/gate.decorator'; import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator'; import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator'; import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata'; import { CalendarChannelEventAssociationObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-channel-event-association.object-metadata'; import { CalendarEventParticipantObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-event-participant.object-metadata'; import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator'; import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids'; import { CALENDAR_EVENT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids'; import { LinkMetadata } from 'src/engine/metadata-modules/field-metadata/composite-types/link.composite-type'; import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator'; @ObjectMetadata({ standardId: STANDARD_OBJECT_IDS.calendarEvent, namePlural: 'calendarEvents', labelSingular: 'Calendar event', labelPlural: 'Calendar events', description: 'Calendar events', icon: 'IconCalendar', }) @IsSystem() @IsNotAuditLogged() @Gate({ featureFlag: FeatureFlagKeys.IsCalendarEnabled, }) export class CalendarEventObjectMetadata extends BaseObjectMetadata { @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.title, type: FieldMetadataType.TEXT, label: 'Title', description: 'Title', icon: 'IconH1', }) title: string; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.isCanceled, type: FieldMetadataType.BOOLEAN, label: 'Is canceled', description: 'Is canceled', icon: 'IconCalendarCancel', }) isCanceled: boolean; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.isFullDay, type: FieldMetadataType.BOOLEAN, label: 'Is Full Day', description: 'Is Full Day', icon: 'Icon24Hours', }) isFullDay: boolean; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.startsAt, type: FieldMetadataType.DATE_TIME, label: 'Start Date', description: 'Start Date', icon: 'IconCalendarClock', }) @IsNullable() startsAt: string | null; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.endsAt, type: FieldMetadataType.DATE_TIME, label: 'End Date', description: 'End Date', icon: 'IconCalendarClock', }) @IsNullable() endsAt: string | null; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.externalCreatedAt, type: FieldMetadataType.DATE_TIME, label: 'Creation DateTime', description: 'Creation DateTime', icon: 'IconCalendarPlus', }) @IsNullable() externalCreatedAt: string | null; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.externalUpdatedAt, type: FieldMetadataType.DATE_TIME, label: 'Update DateTime', description: 'Update DateTime', icon: 'IconCalendarCog', }) @IsNullable() externalUpdatedAt: string | null; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.description, type: FieldMetadataType.TEXT, label: 'Description', description: 'Description', icon: 'IconFileDescription', }) description: string; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.location, type: FieldMetadataType.TEXT, label: 'Location', description: 'Location', icon: 'IconMapPin', }) location: string; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.iCalUID, type: FieldMetadataType.TEXT, label: 'iCal UID', description: 'iCal UID', icon: 'IconKey', }) iCalUID: string; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.conferenceSolution, type: FieldMetadataType.TEXT, label: 'Conference Solution', description: 'Conference Solution', icon: 'IconScreenShare', }) conferenceSolution: string; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.conferenceLink, type: FieldMetadataType.LINK, label: 'Meet Link', description: 'Meet Link', icon: 'IconLink', }) @IsNullable() conferenceLink: LinkMetadata; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.recurringEventExternalId, type: FieldMetadataType.TEXT, label: 'Recurring Event ID', description: 'Recurring Event ID', icon: 'IconHistory', }) recurringEventExternalId: string; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.calendarChannelEventAssociations, type: FieldMetadataType.RELATION, label: 'Calendar Channel Event Associations', description: 'Calendar Channel Event Associations', icon: 'IconCalendar', }) @RelationMetadata({ type: RelationMetadataType.ONE_TO_MANY, inverseSideTarget: () => CalendarChannelEventAssociationObjectMetadata, onDelete: RelationOnDeleteAction.CASCADE, inverseSideFieldKey: 'calendarEvent', }) @Gate({ featureFlag: 'IS_CALENDAR_ENABLED', }) calendarChannelEventAssociations: Relation< CalendarChannelEventAssociationObjectMetadata[] >; @FieldMetadata({ standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.calendarEventParticipants, type: FieldMetadataType.RELATION, label: 'Event Participants', description: 'Event Participants', icon: 'IconUserCircle', }) @RelationMetadata({ type: RelationMetadataType.ONE_TO_MANY, inverseSideTarget: () => CalendarEventParticipantObjectMetadata, onDelete: RelationOnDeleteAction.CASCADE, }) calendarEventParticipants: Relation; }