Makes every day available for events that don't have availability set (#756)

* Abstracts MinutesField

* Adds missing Minimum booking notice

* Refactoring

* Fixes int field sent as string

* Sorts slots by time

* Fixes availability page

* Fixes available days

* Type fixes

* More availability bugfixes

* Makes every day available for events that don't have availability set

* Type fixes
pull/753/head
Omar López 2021-09-23 12:03:07 -06:00 committed by GitHub
parent bcacc1d166
commit 2c50781084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -65,7 +65,15 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
})); }));
const timeZone = eventType?.timeZone || currentUser.timeZone; const timeZone = eventType?.timeZone || currentUser.timeZone;
const workingHours = eventType?.availability.length ? eventType.availability : currentUser.availability; const defaultAvailability = {
startTime: currentUser.startTime,
endTime: currentUser.endTime,
days: [0, 1, 2, 3, 4, 5, 6],
};
const workingHours = eventType?.availability.length
? eventType.availability
: // currentUser.availability /* note(zomars) There's no UI nor default for this as of today */
[defaultAvailability]; /* note(zomars) For now, make every day available as fallback */
res.status(200).json({ res.status(200).json({
busy: bufferedBusyTimes, busy: bufferedBusyTimes,