Merge pull request #284 from Malte-D/hotfix/selected-calendars

pull/285/head
Bailey Pumfleet 2021-06-18 21:27:10 +01:00 committed by GitHub
commit aed5af0f5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -17,7 +17,13 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
});
let availability = await getBusyTimes(currentUser.credentials, req.query.dateFrom, req.query.dateTo);
const selectedCalendars = (await prisma.selectedCalendar.findMany({
where: {
userId: currentUser.id
}
}));
let availability = await getBusyTimes(currentUser.credentials, req.query.dateFrom, req.query.dateTo, selectedCalendars);
availability = availability.map(a => ({
start: dayjs(a.start).subtract(currentUser.bufferTime, 'minute').toString(),