Skip to content

[GF-BE-15] Build Google Calendar OAuth and booking sync service #1090

Description

@yusuftomilola

Problem

Members must manually add their ManageHub bookings to their personal calendars. There is no calendar sync integration, so booking reminders are missed and scheduling conflicts with external meetings are common. All major coworking platforms offer Google Calendar sync as a standard feature.

Proposed Solution

Create a new NestJS module at backend/src/calendar-sync/ using the googleapis npm package (npm install googleapis).

Entity: CalendarToken

  • id (UUID), userId (UUID FK → users, unique)
  • provider (enum: google — extensible for future providers)
  • accessToken (text, encrypted), refreshToken (text, encrypted)
  • expiresAt (timestamp)
  • calendarId (string — the user's selected Google Calendar ID)
  • createdAt, updatedAt

Endpoints:

Method Path Access
GET /calendar-sync/auth/google Authenticated — returns Google OAuth URL
GET /calendar-sync/auth/google/callback OAuth callback (redirects back to frontend)
DELETE /calendar-sync/disconnect Authenticated — revokes and deletes token
GET /calendar-sync/status Authenticated — returns { connected: boolean, provider }

Sync logic: Hook into confirm-booking.provider.ts and cancel-booking.provider.ts. When a booking is confirmed for a user with an active CalendarToken, create a Google Calendar event. When a booking is cancelled, delete the corresponding calendar event. Store the Google event ID on the booking entity (googleCalendarEventId nullable field).

Acceptance Criteria

  • googleapis installed and listed in package.json
  • OAuth flow completes and stores encrypted tokens in CalendarToken
  • GET /calendar-sync/auth/google/callback exchanges the auth code for tokens and redirects to frontend
  • Booking confirmation automatically creates a Google Calendar event for connected users
  • Booking cancellation automatically deletes the corresponding Google Calendar event
  • CalendarSyncModule is registered in AppModule
  • OAuth client credentials (GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REDIRECT_URI) are documented in .env.example

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignStellar WaveIssues in the Stellar wave programbackendenhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions