Fixed cancellation
This commit is contained in:
		
							parent
							
								
									270e6b2d4f
								
							
						
					
					
						commit
						81e1287693
					
				
					 3 changed files with 31 additions and 8 deletions
				
			
		|  | @ -157,7 +157,29 @@ const MicrosoftOffice365Calendar = (credential): CalendarApiAdapter => { | |||
|       optional.location = { displayName: event.location }; | ||||
|     } | ||||
| 
 | ||||
|     return toRet; | ||||
|     return { | ||||
|       subject: event.title, | ||||
|       body: { | ||||
|         contentType: "HTML", | ||||
|         content: event.description, | ||||
|       }, | ||||
|       start: { | ||||
|         dateTime: event.startTime, | ||||
|         timeZone: event.organizer.timeZone, | ||||
|       }, | ||||
|       end: { | ||||
|         dateTime: event.endTime, | ||||
|         timeZone: event.organizer.timeZone, | ||||
|       }, | ||||
|       attendees: event.attendees.map((attendee) => ({ | ||||
|         emailAddress: { | ||||
|           address: attendee.email, | ||||
|           name: attendee.name, | ||||
|         }, | ||||
|         type: "required", | ||||
|       })), | ||||
|       ...optional, | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   const integrationType = "office365_calendar"; | ||||
|  |  | |||
|  | @ -33,9 +33,8 @@ export default class EventManager { | |||
|   } | ||||
| 
 | ||||
|   public async create(event: CalendarEvent): Promise<Array<EventResult>> { | ||||
|     const results: Array<EventResult> = []; | ||||
|     // First, create all calendar events.
 | ||||
|     results.concat(await this.createAllCalendarEvents(event)); | ||||
|     const results: Array<EventResult> = await this.createAllCalendarEvents(event); | ||||
| 
 | ||||
|     // If and only if event type is a video meeting, create a video meeting as well.
 | ||||
|     if (EventManager.isIntegration(event.location)) { | ||||
|  |  | |||
|  | @ -29,11 +29,13 @@ export default async function handler(req, res) { | |||
|     }); | ||||
| 
 | ||||
|     const apiDeletes = async.mapLimit(bookingToDelete.user.credentials, 5, async (credential) => { | ||||
|       const bookingRefUid = bookingToDelete.references.filter((ref) => ref.type === credential.type)[0].uid; | ||||
|       if (credential.type.endsWith("_calendar")) { | ||||
|         return await deleteEvent(credential, bookingRefUid); | ||||
|       } else if (credential.type.endsWith("_video")) { | ||||
|         return await deleteMeeting(credential, bookingRefUid); | ||||
|       const bookingRefUid = bookingToDelete.references.filter((ref) => ref.type === credential.type)[0]?.uid; | ||||
|       if (bookingRefUid) { | ||||
|         if (credential.type.endsWith("_calendar")) { | ||||
|           return await deleteEvent(credential, bookingRefUid); | ||||
|         } else if (credential.type.endsWith("_video")) { | ||||
|           return await deleteMeeting(credential, bookingRefUid); | ||||
|         } | ||||
|       } | ||||
|     }); | ||||
|     const attendeeDeletes = prisma.attendee.deleteMany({ | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 nicolas
						nicolas