Skip to content

Conversation

@ThyMinimalDev
Copy link
Contributor

What does this PR do?

Adds a new trigger.dev task to backfill Google Calendar events when quota issues occur. This converts a manual script into an automated task that can be triggered via trigger.dev.

The task handles two scenarios:

  1. Unsynced accepted bookings - Creates Google Calendar events for bookings that were accepted but failed to sync due to quota limits
  2. Unremoved cancelled bookings - Deletes Google Calendar events for bookings that were cancelled but the deletion failed due to quota limits

Files added/modified:

  • backfill-google-calendar-events.ts - New trigger.dev task definition
  • GoogleCalendarBackfillService.ts - Core backfill logic service
  • schema.ts - Added payload schema for the new task
  • types.ts - Added type definitions for the new task
  • CalendarsTaskService.ts - Added method to invoke the backfill service

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - internal task
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Trigger the task via trigger.dev dashboard with payload:
{
  "startTime": "2026-01-15T16:04:00Z",
  "endTime": "2026-01-15T16:06:00Z"
}
  1. Verify that:
    • Accepted bookings with empty uid in BookingReference get synced to Google Calendar
    • Cancelled bookings with valid uid get deleted from Google Calendar
    • BookingReference records are updated accordingly

Environment variables required:

  • GOOGLE_API_CREDENTIALS must be configured in trigger.dev

Checklist for Human Review

  • Verify the type casting (as unknown as BookingReferenceForBackfill[]) is safe and matches the Prisma select
  • Confirm sendUpdates: "all" is acceptable (sends email notifications to attendees during backfill)
  • Review credential key handling for security concerns
  • Consider if rate limiting is needed to avoid hitting Google API quotas again
  • Hardcoded URL https://app.cal.com/booking/ may not work for self-hosted instances

Link to Devin run: https://app.devin.ai/sessions/ed3400b7f0a0451d980ad1683f850376
Requested by: @ThyMinimalDev

@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants