Skip to content

Hellnight2005/ZenSlot

Repository files navigation

✅ Today’s Work Summary - April 11, 2025

🛠️ Features Implemented

1. Approve Meeting Logic

  • Implemented approveMeeting controller.
  • Updates meeting status to "upcoming".
  • Fetches user from DB via meeting.userId.
  • Uses stored accessToken to create a Google Calendar event.

2. Google Calendar Integration

  • Used googleapis to authenticate with Google using accessToken.
  • Created event on user's primary Google Calendar with:
    • summary (title)
    • description (meeting with user)
    • start and end times
    • Timezone: "Asia/Kolkata"
  • Handled missing times and error cases.

3. Enhanced createCalendarEvent Function

  • Parameters:
    • accessToken
    • startDateTime, endDateTime
    • title, description
    • location, attendees (optional)
  • Added default reminders and safety checks.

🐛 Issues Encountered & Fixed

❌ Error: Cannot read properties of undefined (reading 'title')

  • Fix: Corrected argument structure passed to createCalendarEvent.

❌ Error: Insufficient Permission

  • Fix: Missing scopes during Google OAuth.
  • Updated passport strategy to request:
    passport.authenticate("google", {
      scope: [
        "profile",
        "email",
        "https://www.googleapis.com/auth/calendar",
        "https://www.googleapis.com/auth/calendar.events",
      ],
      accessType: "offline",
      prompt: "consent",
    });

❌ Error: Google Calendar API has not been used

  • Fix: Enabled the Google Calendar API from Google Cloud Console for project ID 519134446809.

🔄 Future Tasks

➕ Google Meet Integration

  • Goal: Auto-generate Google Meet links for events.
  • Steps:
    1. Enable Google Calendar API and Google Meet Conference in the Google Cloud Console.
    2. Update createCalendarEvent to include:
      conferenceDataVersion: 1,
      requestBody: {
        conferenceData: {
          createRequest: {
            requestId: "some-unique-id", // e.g. uuid()
            conferenceSolutionKey: { type: "hangoutsMeet" },
          },
        },
      }

📦 Final Working Files

  • approveMeeting.js – Controller logic for approving meeting & syncing with calendar.
  • createCalendarEvent.js – Calendar helper with customizable parameters.
  • passport.js – OAuth2 strategy updated with correct scopes.
  • auth.js – Login route via Google with updated OAuth2 flow.

Project Summary - Meeting Scheduler with Google Calendar Integration

Date: April 13, 2025

1. Meeting Data Management

  • Integrated Meeting schema with fields like userId, title, selectDay, selectTime, slot, type, user_role, startDateTime, endDateTime, eventId, and meetingLink.
  • Stored user details with accessToken and refreshToken for Google Calendar integration.

2. Google Calendar Integration

  • Implemented calendar event creation using OAuth2 credentials and refresh tokens.
  • Stored eventId and meetingLink from Google Calendar when an event is created.

3. Meeting Rescheduling

  • Handled rescheduling logic without creating a new event.
  • Updated the existing event and reset startDateTime and endDateTime to null after reschedule request.

4. Meeting Deletion Workflow

  • Created deleteCalendarEvent() utility:

    • Accepts eventId and refreshToken.
    • Uses OAuth2 to authenticate and delete the event from the user's Google Calendar.
  • Enhanced deleteMeeting() controller:

    • Fetches the meeting by id.
    • Gets the user by userId from the meeting.
    • Checks if eventId exists:
      • If yes: Deletes event from Google Calendar using refreshToken.
      • If no: Proceeds to delete the meeting directly.
    • Deletes the meeting document from MongoDB.
    • Returns appropriate success or error response.

5. Final Touches

  • Ensured robust error handling and logging.
  • Maintained clean API response structure with success, message, and data.

Next Steps (Optional):

  • Add audit logs or notifications.
  • Implement admin panel to view and manage all meetings.
  • Schedule email reminders using node-cron or similar scheduler.

About

A full-stack Meeting Scheduler with two-way Google Calendar integration, featuring automated event creation and lifecycle management.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors