Closed nicmart-dev closed 4 months ago
Best to rely on n8n for more flexible business logic, but if not here is a possible starter code:
const getAvailableUsers = (users, start, end, hoursPerDay) => {
return users.filter(user => {
const availableSlots = checkAvailability(user.accessToken, user.calendarId, start, end);
// Logic to check if availableSlots meet the required hours per day
return isAvailable(availableSlots, hoursPerDay);
});
};
const isAvailable = (availableSlots, hoursPerDay) => {
// Implement logic to check if the user is available for the required hours per day
};
Will do this with #5 using n8n, but if issues using n8n, may fallback to this and #19
Filter users based on their availability, using availability set in #19