selected calendars hotfix

pull/284/head
Malte Delfs 2021-06-18 22:11:13 +02:00
parent 2441f47c10
commit 95a99c620e
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(),