-
Notifications
You must be signed in to change notification settings - Fork 10.2k
feat: implement Office365 calendar cache and subscription services #22967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devin/1753300938-calendar-cache-sql-system
Are you sure you want to change the base?
feat: implement Office365 calendar cache and subscription services #22967
Conversation
- Add Office365-specific fields to CalendarSubscription model - Create Office365CalendarSubscriptionService following Google patterns - Add Office365CalendarWebhookService for webhook processing - Update CalendarCacheSqlService to handle Office365 events - Add webhook API endpoint for Office365 calendar notifications - Update repository interfaces to support both Google and Office365 - Add required environment variables to turbo.json - Fix TypeScript warnings and improve type safety Co-Authored-By: zomars@cal.com <zomars@me.com>
- Fix subscription parameter types in processGoogleWebhookEvents and processOffice365WebhookEvents - Add proper type annotations for selectedCalendar relation - Ensure compatibility with repository return types Co-Authored-By: zomars@cal.com <zomars@me.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DevinAIm where is this file being used?
The is used through a dispatcher pattern in the main calendar subscription system: Usage Points:1. Main Dispatcher Service:
2. Dynamic Import Pattern: const { CalendarSubscriptionService } = await import(
"@calcom/app-store/office365calendar/lib/CalendarSubscriptionService"
);
const subscriptionService = new CalendarSubscriptionService(credentialWithTenantId);
return await subscriptionService.watchCalendar(calendarId); 3. Integration Flow:
This follows the same pattern as Google Calendar's implementation, keeping provider-specific code isolated in their respective app-store directories while using a common interface. |
- Create CalendarSubscriptionServiceFactory with proper interface segregation - Extract ICalendarSubscriptionService interface for provider implementations - Remove provider-specific logic from main CalendarSubscriptionService - Standardize unwatchCalendar method signatures across providers - Improve separation of concerns following existing getCalendar patterns - Maintain backward compatibility with existing integrations Co-Authored-By: zomars@cal.com <zomars@me.com>
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
…pattern - Create CalendarWebhookServiceFactory for dynamic service instantiation - Move Google Calendar webhook logic to GoogleCalendarWebhookService - Move Office365 Calendar webhook logic to Office365CalendarWebhookService - Remove provider-specific methods from CalendarCacheSqlService - Implement ICalendarWebhookService interface for consistency - Improve separation of concerns and maintainability Co-Authored-By: zomars@cal.com <zomars@me.com>
- Remove unused logger imports from webhook services - Fix non-null assertion in CalendarCacheSqlService - Improve type safety in CalendarWebhookServiceFactory - Update interface definitions to use proper types Co-Authored-By: zomars@cal.com <zomars@me.com>
- Update ICalendarWebhookService interface to use proper types - Replace any with CredentialPayload in Google and Office365 webhook services - Resolves remaining lint warnings for Codacy Static Code Analysis Co-Authored-By: zomars@cal.com <zomars@me.com>
async watchCalendar( | ||
calendarId: string, | ||
credential: CredentialForCalendarService | ||
): Promise<GoogleChannelProps | undefined> { | ||
): Promise<GoogleChannelProps | Office365SubscriptionProps | undefined> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weird to support either type of props here
Refactor CalendarCacheSqlService provider logic using factory pattern
Summary
This PR refactors the
CalendarCacheSqlService
to improve separation of concerns by extracting provider-specific webhook processing logic into dedicated services. The mainCalendarCacheSqlService
previously contained mixed Google Calendar and Office365 logic in a single class, making it difficult to maintain and extend.Key Changes:
CalendarWebhookServiceFactory
for dynamic service instantiation based on credential typeGoogleCalendarWebhookService
Office365CalendarWebhookService
ICalendarWebhookService
interface for consistency across providersThe refactoring maintains all existing functionality while improving code organization and making it easier to add new calendar providers.
Review & Testing Checklist for Human
subject
→summary
,@odata.etag
→etag
, etc.)CalendarWebhookServiceFactory.createService()
correctly instantiates the right service for bothgoogle_calendar
andoffice365_calendar
credential typesfindByChannelId
(Google) andfindByOffice365SubscriptionId
(Office365) work correctly in the refactoredprocessWebhookEvents
methodparseCalendarEvents
andparseOffice365Events
) produce identical database records to the original implementationDiagram
Notes
Session Details: