SPEC 016 — Google Drive Integration
1. Feature Purpose
Google Drive Integration lets organizations connect a Google account and automatically synchronize files from specific Google Drive folders into the Equa Data Room. Admins configure which Google Drive folders map to which Data Room paths, and the system handles ongoing sync — detecting new files, updates, and deletions. This eliminates manual file uploads for teams that already use Google Drive as their primary document store.2. Current State (Verified)
2.1 OAuth Connection Flow
2.2 Sync Configuration
2.3 Sync Execution
2.4 Frontend
3. Data Model
GoogleDriveConnections
GoogleDriveSyncConfigurations
GoogleDriveSyncHistory
GoogleDriveSyncedFiles
4. API Endpoints
5. Frontend Components
Frontend Behavior
- Feature gate — Page is hidden unless
GOOGLE_DRIVE_ENABLEDis true and the user haseditDocumentspermission. - OAuth popup — Connect button opens a popup for Google consent; callback closes the popup and refreshes connection status.
- Sync progress — Manual sync triggers poll the history endpoint until the run status reaches
completedorfailed. - Error display — Configuration-level and file-level sync errors are surfaced inline with retry options.
- Folder picker — Lazy-loads folder children on expand; caches results for the session.
6. Business Rules
- One connection per organization — Only one Google account can be connected at a time; connecting a new account replaces the previous one.
- Read-only access — The integration requests only
drive.readonlyscopes; it never modifies files on Google Drive. - Token refresh — Access tokens are refreshed automatically before API calls when expired; refresh failures set
syncErrorand mark the connection for re-auth. - Google Drive wins — During sync, if a file’s
googleModifiedTimeorgoogleMd5Checksumdiffers from the stored values, the local copy is replaced. - Subfolder opt-in — Subfolders are only traversed when
syncSubfoldersis explicitly enabled on the configuration. - File type filtering — When
fileTypeFilteris set, only files matching the include list (or not in the exclude list) are synced. - Sync isolation — Each configuration syncs independently; a failure in one does not block others.
- History retention — Sync history records are retained indefinitely for audit; the
detailsJSONB field stores per-file outcomes. - Soft disconnect — Disconnecting sets
isActive = falseand revokes the OAuth token but preserves previously synced files in the Data Room. - Google Docs export — Google-native formats (Docs, Sheets, Slides) are exported to their Microsoft Office equivalents (docx, xlsx, pptx) during sync since they lack direct download URLs.
7. Acceptance Criteria
- Admin can connect a Google account via OAuth popup and see the connected email
- Admin can disconnect the Google account; synced files remain in the Data Room
- Admin can browse Google Drive folders and select one for sync
- Admin can map a Google Drive folder to a specific Data Room path
- Admin can enable/disable subfolder traversal per mapping
- Admin can set file type filters (include or exclude by MIME type)
- Manual sync detects new, updated, and deleted files correctly
- Sync history shows accurate counts for processed/added/updated/skipped/failed files
- Failed syncs display error messages with retry option
- Token refresh happens transparently; expired tokens do not block sync
- Google Docs are exported as Office-format files
- Page is not visible when
GOOGLE_DRIVE_ENABLEDis false - Non-admin users cannot connect/disconnect or modify sync configurations