From 3d4a3c7a93910a1475fd4145ce2906b751e68085 Mon Sep 17 00:00:00 2001 From: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Date: Tue, 12 Sep 2023 13:09:05 -0400 Subject: [PATCH] fix: Connect selected calendar to credential (#11283) * Reduce the unhandled promise * Connect selected calendar to credential * Write credential to selected calendar * Type fix * Handle catching promises in separate threads * Only call to list calendars if there are no credentialIds * Changed type of IntegrationCalendar from undef to null * Adding missing property to getting started * Also add calendars.tsx --------- Co-authored-by: Alex van Andel --- .../components/apps/CalendarListContainer.tsx | 1 + .../components/ConnectedCalendarItem.tsx | 1 + apps/web/pages/api/availability/calendar.ts | 4 +- .../pages/settings/my-account/calendars.tsx | 1 + .../features/calendars/CalendarSwitch.tsx | 5 +- .../migration.sql | 5 ++ packages/prisma/schema.prisma | 11 ++- .../deleteCredential.handler.ts | 74 +++++++++++-------- packages/types/Calendar.d.ts | 2 +- 9 files changed, 64 insertions(+), 40 deletions(-) create mode 100644 packages/prisma/migrations/20230911172537_connect_selected_calendar_to_credential/migration.sql diff --git a/apps/web/components/apps/CalendarListContainer.tsx b/apps/web/components/apps/CalendarListContainer.tsx index 8afd92845e..87bce77cdc 100644 --- a/apps/web/components/apps/CalendarListContainer.tsx +++ b/apps/web/components/apps/CalendarListContainer.tsx @@ -116,6 +116,7 @@ function ConnectedCalendarsList(props: Props) { type={item.integration.type} isChecked={cal.isSelected} destination={cal.externalId === props.destinationCalendarId} + credentialId={cal.credentialId} /> ))} diff --git a/apps/web/components/getting-started/components/ConnectedCalendarItem.tsx b/apps/web/components/getting-started/components/ConnectedCalendarItem.tsx index f859274a5e..a611fe69b9 100644 --- a/apps/web/components/getting-started/components/ConnectedCalendarItem.tsx +++ b/apps/web/components/getting-started/components/ConnectedCalendarItem.tsx @@ -53,6 +53,7 @@ const ConnectedCalendarItem = (prop: IConnectedCalendarItem) => {