Add 'free' and 'workingElsewhere' as a non-blocking event (#2652)

* Add 'free' and 'workingElsewhere' to non-blocking event - this will allow bookings at these times

* Update CalendarService.ts

Co-authored-by: zomars <zomars@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Alex van Andel
2022-05-11 21:47:42 +01:00
committed by GitHub
parent 06702aa48a
commit 50632dd9dd
2 changed files with 17 additions and 9 deletions

View File

@@ -107,9 +107,9 @@ export default class Office365CalendarService implements Calendar {
const dateFromParsed = new Date(dateFrom);
const dateToParsed = new Date(dateTo);
const filter = `?startdatetime=${encodeURIComponent(
const filter = `?startDateTime=${encodeURIComponent(
dateFromParsed.toISOString()
)}&enddatetime=${encodeURIComponent(dateToParsed.toISOString())}`;
)}&endDateTime=${encodeURIComponent(dateToParsed.toISOString())}`;
return (await this.auth)
.getToken()
.then(async (accessToken) => {
@@ -142,12 +142,14 @@ export default class Office365CalendarService implements Calendar {
return responseBody.responses.reduce(
(acc: BufferedBusyTime[], subResponse: { body: { value: any[] } }) =>
acc.concat(
subResponse.body.value.map((evt) => {
return {
start: evt.start.dateTime + "Z",
end: evt.end.dateTime + "Z",
};
})
subResponse.body.value
.filter((evt) => evt.showAs !== "free" && evt.showAs !== "workingElsewhere")
.map((evt) => {
return {
start: evt.start.dateTime + "Z",
end: evt.end.dateTime + "Z",
};
})
),
[]
);

View File

@@ -60,7 +60,13 @@ export type BatchResponse = {
};
export type SubResponse = {
body: { value: { start: { dateTime: string }; end: { dateTime: string } }[] };
body: {
value: {
showAs: "free" | "tentative" | "away" | "busy" | "workingElsewhere";
start: { dateTime: string };
end: { dateTime: string };
}[];
};
};
export interface ConferenceData {