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:
@@ -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",
|
||||
};
|
||||
})
|
||||
),
|
||||
[]
|
||||
);
|
||||
|
||||
8
packages/types/Calendar.d.ts
vendored
8
packages/types/Calendar.d.ts
vendored
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user