File tree Expand file tree Collapse file tree
features/bookings/lib/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,6 +123,10 @@ export default class HubspotCalendarService implements CRM {
123123 return this . hubspotClient . crm . objects . meetings . basicApi . update ( uid , simplePublicObjectInput ) ;
124124 } ;
125125
126+ private hubspotArchiveMeeting = async ( uid : string ) => {
127+ return this . hubspotClient . crm . objects . meetings . basicApi . archive ( uid ) ;
128+ } ;
129+
126130 private hubspotAuth = async ( credential : CredentialPayload ) => {
127131 const appKeys = await getAppKeysFromSlug ( "hubspot" ) ;
128132 if ( typeof appKeys . client_id === "string" ) this . client_id = appKeys . client_id ;
@@ -212,9 +216,14 @@ export default class HubspotCalendarService implements CRM {
212216 return await this . hubspotUpdateMeeting ( uid , event ) ;
213217 }
214218
215- async deleteEvent ( uid : string ) : Promise < void > {
219+ async deleteEvent ( uid : string , event : CalendarEvent ) : Promise < void > {
216220 const auth = await this . auth ;
217221 await auth . getToken ( ) ;
222+
223+ if ( event ?. hasOrganizerChanged ) {
224+ await this . hubspotArchiveMeeting ( uid ) ;
225+ return ;
226+ }
218227 await this . hubspotCancelMeeting ( uid ) ;
219228 }
220229
Original file line number Diff line number Diff line change @@ -1884,6 +1884,7 @@ async function handler(
18841884 evt . videoCallData = undefined ;
18851885 // To prevent "The requested identifier already exists" error while updating event, we need to remove iCalUID
18861886 evt . iCalUID = undefined ;
1887+ evt . hasOrganizerChanged = true ;
18871888 }
18881889
18891890 if ( changedOrganizer && originalRescheduledBooking ?. user ) {
Original file line number Diff line number Diff line change @@ -222,6 +222,7 @@ export interface CalendarEvent {
222222 domainWideDelegationCredentialId ?: string | null ;
223223 customReplyToEmail ?: string | null ;
224224 rescheduledBy ?: string ;
225+ hasOrganizerChanged ?: boolean ;
225226}
226227
227228export interface EntryPoint {
You can’t perform that action at this time.
0 commit comments