From 416eb1eafdc3e083c5df5b7222b0518f4a6a461d Mon Sep 17 00:00:00 2001 From: bosiraphael <71827178+bosiraphael@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:17:45 +0100 Subject: [PATCH] 4506 change field labels and field type for calendarevent object metadata to match figma (#4679) * update calendarEvent labels and description to match Figma * modify conferenceUri to conferenceLink with LINK type * update format-google-calendar-event.util to match new conferenceLink * update CalendarEventDetails since overriding the fields is no longer needed * fix mock metadata * generate new uuid for field conferenceLink --- .../src/generated-metadata/graphql.ts | 76 ++++++++++++++++++- .../twenty-front/src/generated/graphql.tsx | 40 ++++++++-- .../components/CalendarEventDetails.tsx | 29 +++---- .../calendar/types/CalendarEvent.ts | 5 +- .../accounts/SettingsAccountsCalendars.tsx | 5 +- .../src/testing/mock-data/metadata.ts | 13 ++-- .../workspace/calendar-events.ts | 6 +- .../dtos/timeline-calendar-event.dto.ts | 13 +++- .../timeline-calendar-event.service.ts | 3 +- .../constants/standard-field-ids.ts | 2 +- .../repositories/calendar-event.repository.ts | 13 ++-- .../calendar-event.object-metadata.ts | 20 ++--- .../modules/calendar/types/calendar-event.ts | 6 +- .../format-google-calendar-event.util.ts | 3 +- 14 files changed, 179 insertions(+), 55 deletions(-) diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.ts index 927fde1380..cea7f2cd31 100644 --- a/packages/twenty-front/src/generated-metadata/graphql.ts +++ b/packages/twenty-front/src/generated-metadata/graphql.ts @@ -175,6 +175,12 @@ export type CreateRelationInput = { toObjectMetadataId: Scalars['String']['input']; }; +export type CreateRemoteServerInput = { + foreignDataWrapperOptions: Scalars['JSON']['input']; + foreignDataWrapperType: Scalars['String']['input']; + userMappingOptions?: InputMaybe; +}; + export type CursorPaging = { /** Paginate after opaque cursor */ after?: InputMaybe; @@ -315,6 +321,12 @@ export type InvalidatePassword = { success: Scalars['Boolean']['output']; }; +export type LinkMetadata = { + __typename?: 'LinkMetadata'; + label: Scalars['String']['output']; + url: Scalars['String']['output']; +}; + export type LoginToken = { __typename?: 'LoginToken'; loginToken: AuthToken; @@ -329,10 +341,12 @@ export type Mutation = { createOneObject: Object; createOneRefreshToken: RefreshToken; createOneRelation: Relation; + createOneRemoteServer: RemoteServer; deleteCurrentWorkspace: Workspace; deleteOneField: FieldDeleteResponse; deleteOneObject: Object; deleteOneRelation: RelationDeleteResponse; + deleteOneRemoteServer: RemoteServer; deleteUser: User; emailPasswordResetLink: EmailPasswordResetLink; generateApiKeyToken: ApiKeyToken; @@ -392,6 +406,11 @@ export type MutationCreateOneRelationArgs = { }; +export type MutationCreateOneRemoteServerArgs = { + input: CreateRemoteServerInput; +}; + + export type MutationDeleteOneFieldArgs = { input: DeleteOneFieldInput; }; @@ -407,6 +426,11 @@ export type MutationDeleteOneRelationArgs = { }; +export type MutationDeleteOneRemoteServerArgs = { + input: RemoteServerIdInput; +}; + + export type MutationEmailPasswordResetLinkArgs = { email: Scalars['String']['input']; }; @@ -545,6 +569,9 @@ export type Query = { currentWorkspace: Workspace; field: Field; fields: FieldConnection; + findAvailableRemoteTablesByServerId: Array; + findManyRemoteServersByType: Array; + findOneRemoteServerById: RemoteServer; findWorkspaceFromInviteHash: Workspace; getProductPrices: ProductPricesEntity; getTimelineCalendarEventsFromCompanyId: TimelineCalendarEventsWithTotal; @@ -585,6 +612,21 @@ export type QueryFieldsArgs = { }; +export type QueryFindAvailableRemoteTablesByServerIdArgs = { + input: RemoteServerIdInput; +}; + + +export type QueryFindManyRemoteServersByTypeArgs = { + input: RemoteServerTypeInput; +}; + + +export type QueryFindOneRemoteServerByIdArgs = { + input: RemoteServerIdInput; +}; + + export type QueryFindWorkspaceFromInviteHashArgs = { inviteHash: Scalars['String']['input']; }; @@ -708,6 +750,38 @@ export enum RelationMetadataType { OneToOne = 'ONE_TO_ONE' } +export type RemoteServer = { + __typename?: 'RemoteServer'; + createdAt: Scalars['DateTime']['output']; + foreignDataWrapperId: Scalars['ID']['output']; + foreignDataWrapperOptions?: Maybe; + foreignDataWrapperType: Scalars['String']['output']; + id: Scalars['ID']['output']; + updatedAt: Scalars['DateTime']['output']; +}; + +export type RemoteServerIdInput = { + /** The id of the record. */ + id: Scalars['ID']['input']; +}; + +export type RemoteServerTypeInput = { + foreignDataWrapperType: Scalars['String']['input']; +}; + +export type RemoteTable = { + __typename?: 'RemoteTable'; + name: Scalars['String']['output']; + schema: Scalars['String']['output']; + status: RemoteTableStatus; +}; + +/** Status of the table */ +export enum RemoteTableStatus { + NotSynced = 'NOT_SYNCED', + Synced = 'SYNCED' +} + export type Sentry = { __typename?: 'Sentry'; dsn?: Maybe; @@ -745,8 +819,8 @@ export type Telemetry = { export type TimelineCalendarEvent = { __typename?: 'TimelineCalendarEvent'; attendees: Array; + conferenceLink: LinkMetadata; conferenceSolution: Scalars['String']['output']; - conferenceUri: Scalars['String']['output']; description: Scalars['String']['output']; endsAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; diff --git a/packages/twenty-front/src/generated/graphql.tsx b/packages/twenty-front/src/generated/graphql.tsx index 3a576f6b20..ef50a7fa13 100644 --- a/packages/twenty-front/src/generated/graphql.tsx +++ b/packages/twenty-front/src/generated/graphql.tsx @@ -235,6 +235,12 @@ export type InvalidatePassword = { success: Scalars['Boolean']; }; +export type LinkMetadata = { + __typename?: 'LinkMetadata'; + label: Scalars['String']; + url: Scalars['String']; +}; + export type LoginToken = { __typename?: 'LoginToken'; loginToken: AuthToken; @@ -547,6 +553,29 @@ export enum RelationMetadataType { OneToOne = 'ONE_TO_ONE' } +export type RemoteServer = { + __typename?: 'RemoteServer'; + createdAt: Scalars['DateTime']; + foreignDataWrapperId: Scalars['ID']; + foreignDataWrapperOptions?: Maybe; + foreignDataWrapperType: Scalars['String']; + id: Scalars['ID']; + updatedAt: Scalars['DateTime']; +}; + +export type RemoteTable = { + __typename?: 'RemoteTable'; + name: Scalars['String']; + schema: Scalars['String']; + status: RemoteTableStatus; +}; + +/** Status of the table */ +export enum RemoteTableStatus { + NotSynced = 'NOT_SYNCED', + Synced = 'SYNCED' +} + export type Sentry = { __typename?: 'Sentry'; dsn?: Maybe; @@ -584,8 +613,8 @@ export type Telemetry = { export type TimelineCalendarEvent = { __typename?: 'TimelineCalendarEvent'; attendees: Array; + conferenceLink: LinkMetadata; conferenceSolution: Scalars['String']; - conferenceUri: Scalars['String']; description: Scalars['String']; endsAt: Scalars['DateTime']; id: Scalars['ID']; @@ -878,9 +907,9 @@ export type RelationEdge = { export type AttendeeFragmentFragment = { __typename?: 'TimelineCalendarEventAttendee', personId?: string | null, workspaceMemberId?: string | null, firstName: string, lastName: string, displayName: string, avatarUrl: string, handle: string }; -export type CalendarEventFragmentFragment = { __typename?: 'TimelineCalendarEvent', id: string, title: string, description: string, location: string, startsAt: string, endsAt: string, isFullDay: boolean, attendees: Array<{ __typename?: 'TimelineCalendarEventAttendee', personId?: string | null, workspaceMemberId?: string | null, firstName: string, lastName: string, displayName: string, avatarUrl: string, handle: string }> }; +export type CalendarEventFragmentFragment = { __typename?: 'TimelineCalendarEvent', id: string, title: string, description: string, location: string, startsAt: string, endsAt: string, isFullDay: boolean, visibility: TimelineCalendarEventVisibility, attendees: Array<{ __typename?: 'TimelineCalendarEventAttendee', personId?: string | null, workspaceMemberId?: string | null, firstName: string, lastName: string, displayName: string, avatarUrl: string, handle: string }> }; -export type TimelineCalendarEventsWithTotalFragmentFragment = { __typename?: 'TimelineCalendarEventsWithTotal', totalNumberOfCalendarEvents: number, timelineCalendarEvents: Array<{ __typename?: 'TimelineCalendarEvent', id: string, title: string, description: string, location: string, startsAt: string, endsAt: string, isFullDay: boolean, attendees: Array<{ __typename?: 'TimelineCalendarEventAttendee', personId?: string | null, workspaceMemberId?: string | null, firstName: string, lastName: string, displayName: string, avatarUrl: string, handle: string }> }> }; +export type TimelineCalendarEventsWithTotalFragmentFragment = { __typename?: 'TimelineCalendarEventsWithTotal', totalNumberOfCalendarEvents: number, timelineCalendarEvents: Array<{ __typename?: 'TimelineCalendarEvent', id: string, title: string, description: string, location: string, startsAt: string, endsAt: string, isFullDay: boolean, visibility: TimelineCalendarEventVisibility, attendees: Array<{ __typename?: 'TimelineCalendarEventAttendee', personId?: string | null, workspaceMemberId?: string | null, firstName: string, lastName: string, displayName: string, avatarUrl: string, handle: string }> }> }; export type GetTimelineCalendarEventsFromCompanyIdQueryVariables = Exact<{ companyId: Scalars['ID']; @@ -889,7 +918,7 @@ export type GetTimelineCalendarEventsFromCompanyIdQueryVariables = Exact<{ }>; -export type GetTimelineCalendarEventsFromCompanyIdQuery = { __typename?: 'Query', getTimelineCalendarEventsFromCompanyId: { __typename?: 'TimelineCalendarEventsWithTotal', totalNumberOfCalendarEvents: number, timelineCalendarEvents: Array<{ __typename?: 'TimelineCalendarEvent', id: string, title: string, description: string, location: string, startsAt: string, endsAt: string, isFullDay: boolean, attendees: Array<{ __typename?: 'TimelineCalendarEventAttendee', personId?: string | null, workspaceMemberId?: string | null, firstName: string, lastName: string, displayName: string, avatarUrl: string, handle: string }> }> } }; +export type GetTimelineCalendarEventsFromCompanyIdQuery = { __typename?: 'Query', getTimelineCalendarEventsFromCompanyId: { __typename?: 'TimelineCalendarEventsWithTotal', totalNumberOfCalendarEvents: number, timelineCalendarEvents: Array<{ __typename?: 'TimelineCalendarEvent', id: string, title: string, description: string, location: string, startsAt: string, endsAt: string, isFullDay: boolean, visibility: TimelineCalendarEventVisibility, attendees: Array<{ __typename?: 'TimelineCalendarEventAttendee', personId?: string | null, workspaceMemberId?: string | null, firstName: string, lastName: string, displayName: string, avatarUrl: string, handle: string }> }> } }; export type GetTimelineCalendarEventsFromPersonIdQueryVariables = Exact<{ personId: Scalars['ID']; @@ -898,7 +927,7 @@ export type GetTimelineCalendarEventsFromPersonIdQueryVariables = Exact<{ }>; -export type GetTimelineCalendarEventsFromPersonIdQuery = { __typename?: 'Query', getTimelineCalendarEventsFromPersonId: { __typename?: 'TimelineCalendarEventsWithTotal', totalNumberOfCalendarEvents: number, timelineCalendarEvents: Array<{ __typename?: 'TimelineCalendarEvent', id: string, title: string, description: string, location: string, startsAt: string, endsAt: string, isFullDay: boolean, attendees: Array<{ __typename?: 'TimelineCalendarEventAttendee', personId?: string | null, workspaceMemberId?: string | null, firstName: string, lastName: string, displayName: string, avatarUrl: string, handle: string }> }> } }; +export type GetTimelineCalendarEventsFromPersonIdQuery = { __typename?: 'Query', getTimelineCalendarEventsFromPersonId: { __typename?: 'TimelineCalendarEventsWithTotal', totalNumberOfCalendarEvents: number, timelineCalendarEvents: Array<{ __typename?: 'TimelineCalendarEvent', id: string, title: string, description: string, location: string, startsAt: string, endsAt: string, isFullDay: boolean, visibility: TimelineCalendarEventVisibility, attendees: Array<{ __typename?: 'TimelineCalendarEventAttendee', personId?: string | null, workspaceMemberId?: string | null, firstName: string, lastName: string, displayName: string, avatarUrl: string, handle: string }> }> } }; export type ParticipantFragmentFragment = { __typename?: 'TimelineThreadParticipant', personId?: string | null, workspaceMemberId?: string | null, firstName: string, lastName: string, displayName: string, avatarUrl: string, handle: string }; @@ -1145,6 +1174,7 @@ export const CalendarEventFragmentFragmentDoc = gql` startsAt endsAt isFullDay + visibility attendees { ...AttendeeFragment } diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventDetails.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventDetails.tsx index ce919021fd..1e47f4db0a 100644 --- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventDetails.tsx +++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventDetails.tsx @@ -6,8 +6,6 @@ import { useObjectMetadataItemOnly } from '@/object-metadata/hooks/useObjectMeta import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { formatFieldMetadataItemAsFieldDefinition } from '@/object-metadata/utils/formatFieldMetadataItemAsFieldDefinition'; import { FieldContext } from '@/object-record/record-field/contexts/FieldContext'; -import { FieldDefinition } from '@/object-record/record-field/types/FieldDefinition'; -import { FieldMetadata } from '@/object-record/record-field/types/FieldMetadata'; import { RecordInlineCell } from '@/object-record/record-inline-cell/components/RecordInlineCell'; import { PropertyBox } from '@/object-record/record-inline-cell/property-box/components/PropertyBox'; import { @@ -77,18 +75,14 @@ export const CalendarEventDetails = ({ objectNameSingular: CoreObjectNameSingular.CalendarEvent, }); - const fieldsToDisplay: Partial< - Record< - keyof CalendarEvent, - Partial, 'label'>> - > - > = { - startsAt: { label: 'Start Date' }, - endsAt: { label: 'End Date' }, - conferenceUri: { label: 'Meet link' }, - location: {}, - description: {}, - }; + const fieldsToDisplay = [ + 'startsAt', + 'endsAt', + 'conferenceLink', + 'location', + 'description', + ]; + const fieldsByName = mapArrayToObject( objectMetadataItem.fields, ({ name }) => name, @@ -116,7 +110,7 @@ export const CalendarEventDetails = ({ - {Object.entries(fieldsToDisplay).map(([fieldName, fieldOverride]) => ( + {fieldsToDisplay.map((fieldName) => ( { isFullDay: false, startsAt: exampleStartDate.toISOString(), conferenceSolution: '', - conferenceUri: '', + conferenceLink: { + label: '', + url: '', + }, description: '', isCanceled: false, location: '', diff --git a/packages/twenty-front/src/testing/mock-data/metadata.ts b/packages/twenty-front/src/testing/mock-data/metadata.ts index d6c6464f41..1f92d8754c 100644 --- a/packages/twenty-front/src/testing/mock-data/metadata.ts +++ b/packages/twenty-front/src/testing/mock-data/metadata.ts @@ -1240,19 +1240,20 @@ const mockedCalendarEventsMetadata = { node: { __typename: 'field', id: '071d3b2a-9168-45bb-9a83-e840eb707d14', - type: 'TEXT', - name: 'conferenceUri', - label: 'Conference URI', - description: 'Conference URI', + type: FieldMetadataType.Link, + name: 'conferenceLink', + label: 'Conference Link', + description: 'Conference Link', icon: 'IconLink', isCustom: false, isActive: true, isSystem: true, - isNullable: false, + isNullable: true, createdAt: '2024-03-15T13:39:09.965Z', updatedAt: '2024-03-15T13:39:09.965Z', defaultValue: { - value: '', + label: 'https://zoom.us', + value: 'https://zoom.us', }, options: null, fromRelationMetadata: null, diff --git a/packages/twenty-server/src/database/typeorm-seeds/workspace/calendar-events.ts b/packages/twenty-server/src/database/typeorm-seeds/workspace/calendar-events.ts index cd643a6c8e..85f3f4e790 100644 --- a/packages/twenty-server/src/database/typeorm-seeds/workspace/calendar-events.ts +++ b/packages/twenty-server/src/database/typeorm-seeds/workspace/calendar-events.ts @@ -22,7 +22,8 @@ export const seedCalendarEvents = async ( 'location', 'iCalUID', 'conferenceSolution', - 'conferenceUri', + 'conferenceLinkLabel', + 'conferenceLinkUrl', 'recurringEventExternalId', ]) .orIgnore() @@ -40,7 +41,8 @@ export const seedCalendarEvents = async ( location: 'Seattle', iCalUID: 'event1@calendar.com', conferenceSolution: 'Zoom', - conferenceUri: 'https://zoom.us/j/1234567890', + conferenceLinkLabel: 'https://zoom.us/j/1234567890', + conferenceLinkUrl: 'https://zoom.us/j/1234567890', recurringEventExternalId: 'recurring1', }, ]) diff --git a/packages/twenty-server/src/engine/core-modules/calendar/dtos/timeline-calendar-event.dto.ts b/packages/twenty-server/src/engine/core-modules/calendar/dtos/timeline-calendar-event.dto.ts index 1ae7f9d759..124d04d02b 100644 --- a/packages/twenty-server/src/engine/core-modules/calendar/dtos/timeline-calendar-event.dto.ts +++ b/packages/twenty-server/src/engine/core-modules/calendar/dtos/timeline-calendar-event.dto.ts @@ -12,6 +12,15 @@ registerEnumType(TimelineCalendarEventVisibility, { description: 'Visibility of the calendar event', }); +@ObjectType('LinkMetadata') +export class LinkMetadata { + @Field() + label: string; + + @Field() + url: string; +} + @ObjectType('TimelineCalendarEvent') export class TimelineCalendarEvent { @Field(() => ID) @@ -41,8 +50,8 @@ export class TimelineCalendarEvent { @Field() conferenceSolution: string; - @Field() - conferenceUri: string; + @Field(() => LinkMetadata) + conferenceLink: LinkMetadata; @Field(() => [TimelineCalendarEventAttendee]) attendees: TimelineCalendarEventAttendee[]; diff --git a/packages/twenty-server/src/engine/core-modules/calendar/timeline-calendar-event.service.ts b/packages/twenty-server/src/engine/core-modules/calendar/timeline-calendar-event.service.ts index d492cbfe25..7a96577cde 100644 --- a/packages/twenty-server/src/engine/core-modules/calendar/timeline-calendar-event.service.ts +++ b/packages/twenty-server/src/engine/core-modules/calendar/timeline-calendar-event.service.ts @@ -214,7 +214,8 @@ export class TimelineCalendarEventService { event.description = ''; event.location = ''; event.conferenceSolution = ''; - event.conferenceUri = ''; + event.conferenceLink.label = ''; + event.conferenceLink.url = ''; } }); diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids.ts index 22f04503e5..894a500211 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids.ts @@ -94,7 +94,7 @@ export const calendarEventStandardFieldIds = { location: '20202020-641a-4ffe-960d-c3c186d95b17', iCalUID: '20202020-f24b-45f4-b6a3-d2f9fcb98714', conferenceSolution: '20202020-1c3f-4b5a-b526-5411a82179eb', - conferenceUri: '20202020-0fc5-490a-871a-2df8a45ab46c', + conferenceLink: '20202020-35da-43ef-9ca0-e936e9dc237b', recurringEventExternalId: '20202020-4b96-43d0-8156-4c7a9717635c', calendarChannelEventAssociations: '20202020-bdf8-4572-a2cc-ecbb6bcc3a02', eventAttendees: '20202020-e07e-4ccb-88f5-6f3d00458eec', diff --git a/packages/twenty-server/src/modules/calendar/repositories/calendar-event.repository.ts b/packages/twenty-server/src/modules/calendar/repositories/calendar-event.repository.ts index 2f23fc1d40..cf8b229497 100644 --- a/packages/twenty-server/src/modules/calendar/repositories/calendar-event.repository.ts +++ b/packages/twenty-server/src/modules/calendar/repositories/calendar-event.repository.ts @@ -136,12 +136,13 @@ export class CalendarEventRepository { location: 'text', iCalUID: 'text', conferenceSolution: 'text', - conferenceUri: 'text', + conferenceLinkLabel: 'text', + conferenceLinkUrl: 'text', recurringEventExternalId: 'text', }); await this.workspaceDataSourceService.executeRawQuery( - `INSERT INTO ${dataSourceSchema}."calendarEvent" ("id", "title", "isCanceled", "isFullDay", "startsAt", "endsAt", "externalCreatedAt", "externalUpdatedAt", "description", "location", "iCalUID", "conferenceSolution", "conferenceUri", "recurringEventExternalId") VALUES ${valuesString}`, + `INSERT INTO ${dataSourceSchema}."calendarEvent" ("id", "title", "isCanceled", "isFullDay", "startsAt", "endsAt", "externalCreatedAt", "externalUpdatedAt", "description", "location", "iCalUID", "conferenceSolution", "conferenceLinkLabel", "conferenceLinkUrl", "recurringEventExternalId") VALUES ${valuesString}`, flattenedValues, workspaceId, transactionManager, @@ -173,7 +174,8 @@ export class CalendarEventRepository { location: 'text', iCalUID: 'text', conferenceSolution: 'text', - conferenceUri: 'text', + conferenceLinkLabel: 'text', + conferenceLinkUrl: 'text', recurringEventExternalId: 'text', }); @@ -189,10 +191,11 @@ export class CalendarEventRepository { "description" = "newData"."description", "location" = "newData"."location", "conferenceSolution" = "newData"."conferenceSolution", - "conferenceUri" = "newData"."conferenceUri", + "conferenceLinkLabel" = "newData"."conferenceLinkLabel", + "conferenceLinkUrl" = "newData"."conferenceLinkUrl", "recurringEventExternalId" = "newData"."recurringEventExternalId" FROM (VALUES ${valuesString}) - AS "newData"("title", "isCanceled", "isFullDay", "startsAt", "endsAt", "externalCreatedAt", "externalUpdatedAt", "description", "location", "iCalUID", "conferenceSolution", "conferenceUri", "recurringEventExternalId") + AS "newData"("title", "isCanceled", "isFullDay", "startsAt", "endsAt", "externalCreatedAt", "externalUpdatedAt", "description", "location", "iCalUID", "conferenceSolution", "conferenceLinkLabel", "conferenceLinkUrl", "recurringEventExternalId") WHERE "calendarEvent"."iCalUID" = "newData"."iCalUID"`, flattenedValues, workspaceId, diff --git a/packages/twenty-server/src/modules/calendar/standard-objects/calendar-event.object-metadata.ts b/packages/twenty-server/src/modules/calendar/standard-objects/calendar-event.object-metadata.ts index fcba4feb05..a940157f4d 100644 --- a/packages/twenty-server/src/modules/calendar/standard-objects/calendar-event.object-metadata.ts +++ b/packages/twenty-server/src/modules/calendar/standard-objects/calendar-event.object-metadata.ts @@ -15,6 +15,7 @@ import { CalendarEventAttendeeObjectMetadata } from 'src/modules/calendar/standa import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator'; import { standardObjectIds } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids'; import { calendarEventStandardFieldIds } 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'; @ObjectMetadata({ standardId: standardObjectIds.calendarEvent, @@ -59,8 +60,8 @@ export class CalendarEventObjectMetadata extends BaseObjectMetadata { @FieldMetadata({ standardId: calendarEventStandardFieldIds.startsAt, type: FieldMetadataType.DATE_TIME, - label: 'Start DateTime', - description: 'Start DateTime', + label: 'Start Date', + description: 'Start Date', icon: 'IconCalendarClock', }) @IsNullable() @@ -69,8 +70,8 @@ export class CalendarEventObjectMetadata extends BaseObjectMetadata { @FieldMetadata({ standardId: calendarEventStandardFieldIds.endsAt, type: FieldMetadataType.DATE_TIME, - label: 'End DateTime', - description: 'End DateTime', + label: 'End Date', + description: 'End Date', icon: 'IconCalendarClock', }) @IsNullable() @@ -133,13 +134,14 @@ export class CalendarEventObjectMetadata extends BaseObjectMetadata { conferenceSolution: string; @FieldMetadata({ - standardId: calendarEventStandardFieldIds.conferenceUri, - type: FieldMetadataType.TEXT, - label: 'Conference URI', - description: 'Conference URI', + standardId: calendarEventStandardFieldIds.conferenceLink, + type: FieldMetadataType.LINK, + label: 'Meet Link', + description: 'Meet Link', icon: 'IconLink', }) - conferenceUri: string; + @IsNullable() + conferenceLink: LinkMetadata; @FieldMetadata({ standardId: calendarEventStandardFieldIds.recurringEventExternalId, diff --git a/packages/twenty-server/src/modules/calendar/types/calendar-event.ts b/packages/twenty-server/src/modules/calendar/types/calendar-event.ts index 4cd9450932..6b8a9363ac 100644 --- a/packages/twenty-server/src/modules/calendar/types/calendar-event.ts +++ b/packages/twenty-server/src/modules/calendar/types/calendar-event.ts @@ -9,7 +9,11 @@ export type CalendarEvent = Omit< | 'calendarChannelEventAssociations' | 'calendarEventAttendees' | 'eventAttendees' ->; + | 'conferenceLink' +> & { + conferenceLinkLabel: string; + conferenceLinkUrl: string; +}; export type CalendarEventAttendee = Omit< ObjectRecord, diff --git a/packages/twenty-server/src/modules/calendar/utils/format-google-calendar-event.util.ts b/packages/twenty-server/src/modules/calendar/utils/format-google-calendar-event.util.ts index e99234263c..f23fc9ac74 100644 --- a/packages/twenty-server/src/modules/calendar/utils/format-google-calendar-event.util.ts +++ b/packages/twenty-server/src/modules/calendar/utils/format-google-calendar-event.util.ts @@ -37,7 +37,8 @@ export const formatGoogleCalendarEvent = ( iCalUID: event.iCalUID ?? '', conferenceSolution: event.conferenceData?.conferenceSolution?.key?.type ?? '', - conferenceUri: event.conferenceData?.entryPoints?.[0]?.uri ?? '', + conferenceLinkLabel: event.conferenceData?.entryPoints?.[0]?.uri ?? '', + conferenceLinkUrl: event.conferenceData?.entryPoints?.[0]?.uri ?? '', recurringEventExternalId: event.recurringEventId ?? '', attendees: event.attendees?.map((attendee) => ({