mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-01-06 03:30:25 -06:00
This commit implements a comprehensive refactoring of the integration system to support both global (shared) and per-user integrations, adds new integrations, and improves the overall architecture. Key changes: - Add global integrations support: most integrations are now shared across all users (Jira, Slack, GitHub, Asana, Trello, GitLab, Microsoft Teams, Outlook Calendar, Xero) - Add new integrations: GitLab, Microsoft Teams, Outlook Calendar, and Xero - Database migrations: * Migration 081: Add OAuth credential columns for all integrations to Settings model * Migration 082: Add is_global flag to Integration model and make user_id nullable - Update Integration model to support global integrations with nullable user_id - Refactor IntegrationService to handle both global and per-user integrations - Create dedicated admin setup pages for each integration - Update Trello connector to use API key setup instead of OAuth flow - Enhance all existing integrations (Jira, Slack, GitHub, Google Calendar, Asana, Trello) with global support - Update routes, templates, and services to support the new global/per-user distinction - Improve integration management UI with better separation of global vs per-user integrations - Update scheduled tasks to work with the new integration architecture
2.2 KiB
2.2 KiB
Integration System Refactoring Plan
Issues Identified
- Double Pages:
/calendar/integrationsand/integrations- duplicate functionality - OAuth Requirements: Some integrations (Trello) don't need OAuth but are using OAuth flow
- Global vs Per-User: All integrations are currently per-user, but should be global (except Google Calendar)
- Setup Pages: Need dedicated setup pages for each integration instead of all in one settings page
Solution
1. Database Changes
- ✅ Migration 082: Add
is_globalflag to Integration model - ✅ Make
user_idnullable for global integrations - ✅ Add constraint: global integrations must have
user_id = NULL
2. Integration Classification
Global Integrations (shared across all users):
- Jira
- Slack
- GitHub
- Outlook Calendar
- Microsoft Teams
- Asana
- Trello (API key based, not OAuth)
- GitLab
- QuickBooks
- Xero
Per-User Integrations:
- Google Calendar (each user connects their own)
3. OAuth vs API Key Requirements
OAuth Required:
- Jira (OAuth 2.0)
- Slack (OAuth 2.0)
- GitHub (OAuth 2.0)
- Google Calendar (OAuth 2.0) - per-user
- Outlook Calendar (OAuth 2.0)
- Microsoft Teams (OAuth 2.0)
- Asana (OAuth 2.0)
- GitLab (OAuth 2.0)
- QuickBooks (OAuth 2.0)
- Xero (OAuth 2.0)
API Key Based (no OAuth):
- Trello (API Key + Token)
4. Implementation Steps
- ✅ Create migration for global integrations
- ✅ Update Integration model
- Update IntegrationService to handle global integrations
- Create admin setup pages for each integration
- Fix Trello connector to use API key setup (not OAuth)
- Remove duplicate calendar integrations page
- Update routes to use global integrations
- Update integration list page to show global vs per-user
Files to Modify
app/models/integration.py- Add is_global, make user_id nullableapp/services/integration_service.py- Handle global integrationsapp/routes/integrations.py- Update to handle globalapp/routes/admin.py- Add setup routes for each integrationapp/integrations/trello.py- Fix to use API key setupapp/routes/calendar.py- Remove duplicate integrations pageapp/templates/integrations/- Create setup templates