diff --git a/apps/api/v2/package.json b/apps/api/v2/package.json index e61061c6b0..6a004e5e4f 100644 --- a/apps/api/v2/package.json +++ b/apps/api/v2/package.json @@ -38,7 +38,7 @@ "@axiomhq/winston": "^1.2.0", "@calcom/platform-constants": "*", "@calcom/platform-enums": "*", - "@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.176", + "@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.178", "@calcom/platform-libraries-0.0.2": "npm:@calcom/platform-libraries@0.0.2", "@calcom/platform-types": "*", "@calcom/platform-utils": "*", diff --git a/packages/app-store/office365calendar/lib/CalendarService.ts b/packages/app-store/office365calendar/lib/CalendarService.ts index edc6a418a2..3e6765f153 100644 --- a/packages/app-store/office365calendar/lib/CalendarService.ts +++ b/packages/app-store/office365calendar/lib/CalendarService.ts @@ -8,6 +8,7 @@ import { CalendarAppDelegationCredentialConfigurationError, } from "@calcom/lib/CalendarAppError"; import { handleErrorsJson, handleErrorsRaw } from "@calcom/lib/errors"; +import { formatCalEvent } from "@calcom/lib/formatCalendarEvent"; import logger from "@calcom/lib/logger"; import type { BufferedBusyTime } from "@calcom/types/BufferedBusyTime"; import type { @@ -249,9 +250,10 @@ export default class Office365CalendarService implements Calendar { ? `${await this.getUserEndpoint()}/calendars/${mainHostDestinationCalendar?.externalId}/events` : `${await this.getUserEndpoint()}/calendar/events`; + const formattedEvent = formatCalEvent(event); const response = await this.fetcher(eventsUrl, { method: "POST", - body: JSON.stringify(this.translateEvent(event)), + body: JSON.stringify(this.translateEvent(formattedEvent)), }); const responseJson = await handleErrorsJson(response); diff --git a/packages/lib/CalendarService.ts b/packages/lib/CalendarService.ts index 957a8e7958..88d764363c 100644 --- a/packages/lib/CalendarService.ts +++ b/packages/lib/CalendarService.ts @@ -32,6 +32,7 @@ import type { CredentialPayload } from "@calcom/types/Credential"; import { getLocation, getRichDescription } from "./CalEventParser"; import { symmetricDecrypt } from "./crypto"; +import { formatCalEvent } from "./formatCalendarEvent"; import logger from "./logger"; const TIMEZONE_FORMAT = "YYYY-MM-DDTHH:mm:ss[Z]"; @@ -139,10 +140,10 @@ export default abstract class BaseCalendarService implements Calendar { return attendees; } - async createEvent(event: CalendarEvent, credentialId: number): Promise { + async createEvent(eventRaw: CalendarEvent, credentialId: number): Promise { try { - const calendars = await this.listCalendars(event); - + const calendars = await this.listCalendars(eventRaw); + const event = formatCalEvent(eventRaw); const uid = uuidv4(); // We create local ICS files