Implemented configurable eventType phone or physical locations.

This commit is contained in:
Alex van Andel committed 2021-05-08 19:03:47 +00:00
1 parent 640ea4031d
commit a6c3c7fbb3
10 files changed
+349 -119

No files matched your search

+36 -22
View File
@@ -49,6 +49,7 @@ interface CalendarEvent {
timeZone: string;
endTime: string;
description?: string;
location?: string;
organizer: { name?: string, email: string };
attendees: { name?: string, email: string }[];
};
@@ -57,28 +58,37 @@ const MicrosoftOffice365Calendar = (credential) => {
const auth = o365Auth(credential);
const translateEvent = (event: CalendarEvent) => ({
subject: event.title,
body: {
contentType: 'HTML',
content: event.description,
},
start: {
dateTime: event.startTime,
timeZone: event.timeZone,
},
end: {
dateTime: event.endTime,
timeZone: event.timeZone,
},
attendees: event.attendees.map(attendee => ({
emailAddress: {
address: attendee.email,
name: attendee.name
const translateEvent = (event: CalendarEvent) => {
let optional = {};
if (event.location) {
optional.location = { displayName: event.location };
}
return {
subject: event.title,
body: {
contentType: 'HTML',
content: event.description,
},
type: "required"
}))
});
start: {
dateTime: event.startTime,
timeZone: event.timeZone,
},
end: {
dateTime: event.endTime,
timeZone: event.timeZone,
},
attendees: event.attendees.map(attendee => ({
emailAddress: {
address: attendee.email,
name: attendee.name
},
type: "required"
})),
...optional
}
};
return {
getAvailability: (dateFrom, dateTo) => {
@@ -119,7 +129,7 @@ const MicrosoftOffice365Calendar = (credential) => {
'Content-Type': 'application/json',
},
body: JSON.stringify(translateEvent(event))
}))
}).then(handleErrors))
}
};
@@ -165,6 +175,10 @@ const GoogleCalendar = (credential) => {
},
};
if (event.location) {
payload['location'] = event.location;
}
const calendar = google.calendar({version: 'v3', auth: myGoogleAuth });
calendar.events.insert({
auth: myGoogleAuth,
+6
View File
@@ -0,0 +1,6 @@
export enum LocationType {
InPerson = 'inPerson',
Phone = 'phone',
}