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
This commit is contained in:
Omar López authored and GitHub committed 2021-09-23 12:03:07 -06:00
1 parent bcacc1d166
commit 2c50781084
1 file changed
+9 -1
+9 -1
View File
@@ -65,7 +65,15 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}));
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({
busy: bufferedBusyTimes,