Calendar Sync
CaseSolo supports Google Calendar and Microsoft Outlook Calendar as launch-grade calendar providers. The implementation is split between provider clients and a unified readiness surface.
Provider Client Coverage
The provider clients live in:
src/lib/integrations/google-calendar.tssrc/lib/integrations/microsoft-calendar.ts
Both clients cover the required calendar sync primitives:
- OAuth authorization URL generation.
- Authorization-code token exchange.
- Refresh-token renewal before access-token expiry.
- Provider event create, update, and delete.
- Provider conflict detection for overlapping event windows.
- Push subscription setup and renewal primitives.
- Incremental pull sync using Google sync tokens or Microsoft delta links.
- Court-hearing event builders with CaseSolo case metadata.
- Task deadline push to the external calendar with CaseSolo event IDs persisted in task metadata.
Readiness API
GET /api/integrations/calendar-sync returns a secret-safe readiness snapshot for the authenticated user.
Response fields:
generatedAt: ISO timestamp for the readiness snapshot.summary.total: number of supported providers.summary.connected: providers with stored OAuth configuration.summary.ready: providers with healthy token state, healthy push state, and completed initial incremental sync state.summary.attention: connected providers needing launch work.providers[].tokenState:missing,expired,expiring_soon, orhealthy.providers[].pushState:missing,expired,expiring_soon, orhealthy.providers[].incrementalState:initial_sync_requiredorready.providers[].capabilities: static capability proof for OAuth, token refresh, two-way sync, push subscriptions, conflict detection, and court-hearing auto-population.providers[].nextActions: user-visible remediation steps.
The endpoint intentionally does not return access tokens, refresh tokens, Google sync tokens, Microsoft delta tokens, channel IDs, resource IDs, subscription IDs, or OAuth secrets.
Metadata Shape
Calendar settings are stored on user.metadata.googleCalendar and user.metadata.microsoftCalendar.
Google Calendar uses:
connectedtokens.expiresAtcalendarIdsyncEnabledlastSyncedchannelExpirationsyncToken
Microsoft Outlook Calendar uses:
connectedtokens.expiresAtcalendarIdsyncEnabledlastSyncedsubscriptionExpirationdeltaToken
Launch Gate
The calendar sync slice is not launch-ready unless these checks pass:
- Provider client unit tests for Google Calendar and Microsoft Outlook Calendar.
- Readiness library tests for disconnected, ready, and degraded states.
- API route tests for auth, no-cache headers, capability reporting, and secret redaction.
- Typecheck across the repo.
- ESLint on touched calendar sync files.