feat: refactor Todoist integration to single app with OAuth
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 32s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 32s
- Single webhook URL for all users - OAuth authorization flow - Removed individual webhook tokens - User identification by todoist_user_id - Added OAuth endpoints: connect, callback, status, disconnect - Updated frontend with OAuth flow - DB migration 013: removed webhook_token, added todoist_user_id, todoist_email, access_token Version: 2.2.0
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
-- Migration: Refactor todoist_integrations for single Todoist app
|
||||
-- Webhook теперь единый для всего приложения, токены в URL больше не нужны
|
||||
-- Все пользователи используют одно Todoist приложение
|
||||
|
||||
-- ============================================
|
||||
-- 1. Добавляем новые поля
|
||||
-- ============================================
|
||||
ALTER TABLE todoist_integrations
|
||||
ADD COLUMN IF NOT EXISTS todoist_user_id BIGINT;
|
||||
|
||||
ALTER TABLE todoist_integrations
|
||||
ADD COLUMN IF NOT EXISTS todoist_email VARCHAR(255);
|
||||
|
||||
ALTER TABLE todoist_integrations
|
||||
ADD COLUMN IF NOT EXISTS access_token TEXT;
|
||||
|
||||
-- ============================================
|
||||
-- 2. Удаляем webhook_token (больше не нужен!)
|
||||
-- ============================================
|
||||
ALTER TABLE todoist_integrations
|
||||
DROP COLUMN IF EXISTS webhook_token;
|
||||
|
||||
-- ============================================
|
||||
-- 3. Удаляем старый индекс на webhook_token
|
||||
-- ============================================
|
||||
DROP INDEX IF EXISTS idx_todoist_integrations_webhook_token;
|
||||
|
||||
-- ============================================
|
||||
-- 4. Создаем новые индексы
|
||||
-- ============================================
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_todoist_integrations_todoist_user_id
|
||||
ON todoist_integrations(todoist_user_id)
|
||||
WHERE todoist_user_id IS NOT NULL;
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_todoist_integrations_todoist_email
|
||||
ON todoist_integrations(todoist_email)
|
||||
WHERE todoist_email IS NOT NULL;
|
||||
|
||||
-- ============================================
|
||||
-- 5. Комментарии
|
||||
-- ============================================
|
||||
COMMENT ON COLUMN todoist_integrations.todoist_user_id IS 'Todoist user ID (from OAuth) - used to identify user in webhooks';
|
||||
COMMENT ON COLUMN todoist_integrations.todoist_email IS 'Todoist user email (from OAuth)';
|
||||
COMMENT ON COLUMN todoist_integrations.access_token IS 'Todoist OAuth access token (permanent)';
|
||||
|
||||
Reference in New Issue
Block a user