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
This commit is contained in:
bosiraphael 2024-03-27 15:17:45 +01:00 committed by GitHub
parent 2ffe519478
commit 416eb1eafd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 179 additions and 55 deletions

View File

@ -175,6 +175,12 @@ export type CreateRelationInput = {
toObjectMetadataId: Scalars['String']['input'];
};
export type CreateRemoteServerInput = {
foreignDataWrapperOptions: Scalars['JSON']['input'];
foreignDataWrapperType: Scalars['String']['input'];
userMappingOptions?: InputMaybe<Scalars['JSON']['input']>;
};
export type CursorPaging = {
/** Paginate after opaque cursor */
after?: InputMaybe<Scalars['ConnectionCursor']['input']>;
@ -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<RemoteTable>;
findManyRemoteServersByType: Array<RemoteServer>;
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<Scalars['JSON']['output']>;
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<Scalars['String']['output']>;
@ -745,8 +819,8 @@ export type Telemetry = {
export type TimelineCalendarEvent = {
__typename?: 'TimelineCalendarEvent';
attendees: Array<TimelineCalendarEventAttendee>;
conferenceLink: LinkMetadata;
conferenceSolution: Scalars['String']['output'];
conferenceUri: Scalars['String']['output'];
description: Scalars['String']['output'];
endsAt: Scalars['DateTime']['output'];
id: Scalars['ID']['output'];

View File

@ -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<Scalars['JSON']>;
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<Scalars['String']>;
@ -584,8 +613,8 @@ export type Telemetry = {
export type TimelineCalendarEvent = {
__typename?: 'TimelineCalendarEvent';
attendees: Array<TimelineCalendarEventAttendee>;
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
}

View File

@ -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<Pick<FieldDefinition<FieldMetadata>, '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 = ({
</StyledCreatedAt>
</StyledHeader>
<StyledFields>
{Object.entries(fieldsToDisplay).map(([fieldName, fieldOverride]) => (
{fieldsToDisplay.map((fieldName) => (
<StyledPropertyBox key={fieldName}>
<FieldContext.Provider
value={{
@ -125,10 +119,7 @@ export const CalendarEventDetails = ({
recoilScopeId: `${calendarEvent.id}-${fieldName}`,
isLabelIdentifier: false,
fieldDefinition: formatFieldMetadataItemAsFieldDefinition({
field: {
...fieldsByName[fieldName],
...fieldOverride,
},
field: fieldsByName[fieldName],
objectMetadataItem,
showLabel: true,
labelWidth: 72,

View File

@ -1,6 +1,9 @@
// TODO: use backend CalendarEvent type when ready
export type CalendarEvent = {
conferenceUri?: string;
conferenceLink?: {
label: string;
url: string;
};
description?: string;
endsAt?: string;
externalCreatedAt: string;

View File

@ -69,7 +69,10 @@ export const SettingsAccountsCalendars = () => {
isFullDay: false,
startsAt: exampleStartDate.toISOString(),
conferenceSolution: '',
conferenceUri: '',
conferenceLink: {
label: '',
url: '',
},
description: '',
isCanceled: false,
location: '',

View File

@ -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,

View File

@ -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',
},
])

View File

@ -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[];

View File

@ -214,7 +214,8 @@ export class TimelineCalendarEventService {
event.description = '';
event.location = '';
event.conferenceSolution = '';
event.conferenceUri = '';
event.conferenceLink.label = '';
event.conferenceLink.url = '';
}
});

View File

@ -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',

View File

@ -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,

View File

@ -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,

View File

@ -9,7 +9,11 @@ export type CalendarEvent = Omit<
| 'calendarChannelEventAssociations'
| 'calendarEventAttendees'
| 'eventAttendees'
>;
| 'conferenceLink'
> & {
conferenceLinkLabel: string;
conferenceLinkUrl: string;
};
export type CalendarEventAttendee = Omit<
ObjectRecord<CalendarEventAttendeeObjectMetadata>,

View File

@ -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) => ({