nicmart-dev / linguistnow

LinguistNow simplifies the hassle of finding available linguists for translation projects.
https://linguistnow.netlify.app
1 stars 1 forks source link

Check Availability #19

Closed nicmart-dev closed 1 month ago

nicmart-dev commented 1 month ago

Query the selected calendars to check for available time slots, using calendar selected in #18

nicmart-dev commented 1 month ago

Best to rely on n8n business logic, but otherwise here is a starter code:

const checkAvailability = async (accessToken, calendarId, start, end) => {
  const calendar = google.calendar({ version: 'v3', auth: accessToken });

  const events = await calendar.events.list({
    calendarId: calendarId,
    timeMin: start,
    timeMax: end,
    singleEvents: true,
    orderBy: 'startTime',
  });

  return events.data.items;
};
nicmart-dev commented 1 month ago

Will do this with #5 using n8n but if issues, may fallback to not using n8n for this.