const { Pool } = require('pg'); const fs = require('fs'); async function run() { const pool = new Pool({ connectionString: 'postgresql://postgres:postgres@localhost:5432/xflow' }); const nodes = [ { id: 'root', type: 'text', x: 0, y: 0, width: 400, height: 100, text: '# План Развития XFlow\nВизуальная CRM/ERP Система', style: { background: '#1e293b', border: '#3b82f6' } }, // Stage 1 { id: 'stage1', type: 'text', x: -500, y: 200, width: 350, height: 150, text: '## Этап 1: Фундамент\nРоли (RBAC), Управление Командой, Master Canvas', style: { background: '#1e293b', border: '#3b82f6' } }, { id: 's1-1', type: 'task', x: -900, y: 400, width: 300, height: 120, text: 'Система Ролей (RBAC)', state: 'todo', assigned_to: 'admin', priority: 'high' }, { id: 's1-2', type: 'task', x: -500, y: 450, width: 300, height: 120, text: 'Интерфейс приглашения юзеров', state: 'todo', assigned_to: 'admin', priority: 'medium' }, // Stage 2 { id: 'stage2', type: 'text', x: 0, y: 200, width: 350, height: 150, text: '## Этап 2: Умные Узлы\nТипизация, Панель свойств, Цветовая индикация', style: { background: '#1e293b', border: '#10b981' } }, { id: 's2-1', type: 'task', x: -150, y: 400, width: 300, height: 120, text: 'Герметичное сохранение метаданных', state: 'completed', assigned_to: 'antigravity', priority: 'high' }, { id: 's2-2', type: 'task', x: 150, y: 450, width: 300, height: 120, text: 'Типизация (Webhook, AI, Git)', state: 'completed', assigned_to: 'antigravity', priority: 'high' }, // Stage 3 { id: 'stage3', type: 'text', x: 500, y: 200, width: 350, height: 150, text: '## Этап 3: Аналитика\nКанбан-борд, Дашборд, Уведомления', style: { background: '#1e293b', border: '#8b5cf6' } }, { id: 's3-1', type: 'task', x: 500, y: 400, width: 300, height: 120, text: 'Персональный Канбан-дашборд', state: 'completed', assigned_to: 'antigravity', priority: 'high' }, { id: 's3-2', type: 'task', x: 900, y: 450, width: 300, height: 120, text: 'Drag-n-Drop в Канбане', state: 'todo', assigned_to: 'admin', priority: 'medium' }, // Stage 4 { id: 'stage4', type: 'text', x: 0, y: 650, width: 400, height: 150, text: '## Этап 4: Интеграции\nGit/Gitea Deep Sync, S3 Storage, Workflows', style: { background: '#1e293b', border: '#f59e0b' } }, // Update { id: 'update', type: 'text', x: -500, y: -200, width: 400, height: 200, text: '### Обновление 28.04\n✅ Сохранение метаданных\n✅ База под Канбан\n✅ Типизация узлов', style: { background: '#064e3b', border: '#10b981' } } ]; const edges = [ { id: 'e1', source: 'root', target: 'stage1' }, { id: 'e2', source: 'root', target: 'stage2' }, { id: 'e3', source: 'root', target: 'stage3' }, { id: 'e4', source: 'root', target: 'stage4' }, { id: 'e5', source: 'root', target: 'update' }, { id: 'e1-1', source: 'stage1', target: 's1-1' }, { id: 'e1-2', source: 'stage1', target: 's1-2' }, { id: 'e2-1', source: 'stage2', target: 's2-1' }, { id: 'e2-2', source: 'stage2', target: 's2-2' }, { id: 'e3-1', source: 'stage3', target: 's3-1' }, { id: 'e3-2', source: 'stage3', target: 's3-2' } ]; const canvasId = 'master-plan'; const name = '🗺️ Генеральный План Развития'; // Upsert the canvas await pool.query( `INSERT INTO "Canvas" (id, name, nodes, edges, "ownerId", "isPublic", "createdAt", "updatedAt") VALUES ($1, $2, $3, $4, 'system', true, NOW(), NOW()) ON CONFLICT (id) DO UPDATE SET nodes = $3, edges = $4, name = $2, "updatedAt" = NOW()`, [canvasId, name, JSON.stringify(nodes), JSON.stringify(edges)] ); console.log('Master plan published to database as canvas: master-plan'); await pool.end(); } run().catch(console.error);