diff --git a/Jenkinsfile b/Jenkinsfile index 355ae80..5021fbe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -255,7 +255,7 @@ pipeline { # Test API Gateway endpoint (if available) echo "Testing API Gateway health..." - timeout 30 bash -c "until curl -f http://localhost:8000/health 2>/dev/null; do echo \\"Waiting for API Gateway...\\"; sleep 5; done" || echo "API Gateway health check timeout" + timeout 30 bash -c "until curl -f https://dashboard.codenuk.com/health 2>/dev/null; do echo \\"Waiting for API Gateway...\\"; sleep 5; done" || echo "API Gateway health check timeout" echo "Container resource usage:" docker stats --no-stream --format "table {{.Container}}\\t{{.CPUPerc}}\\t{{.MemUsage}}" diff --git a/config/urls.js b/config/urls.js index bddde4f..5771593 100644 --- a/config/urls.js +++ b/config/urls.js @@ -6,14 +6,14 @@ // ======================================== // LIVE PRODUCTION URLS (Currently Active) // ======================================== -// const FRONTEND_URL = 'https://dashboard.codenuk.com'; -// const BACKEND_URL = 'https://backend.codenuk.com'; +const FRONTEND_URL = 'https://dashboard.codenuk.com'; +const BACKEND_URL = 'https://backend.codenuk.com'; // ======================================== // LOCAL DEVELOPMENT URLS // ======================================== -const FRONTEND_URL = 'http://localhost:3001'; -const BACKEND_URL = 'http://localhost:8000'; +// const FRONTEND_URL = 'http://localhost:3001'; +// const BACKEND_URL = 'http://localhost:8000'; // ======================================== // CORS CONFIGURATION (Auto-generated) diff --git a/docker-compose.yml b/docker-compose.yml index 1bb8f55..4a27123 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -233,7 +233,7 @@ services: - NODE_ENV=development - PORT=8000 - HOST=0.0.0.0 - - CORS_ORIGINS=http://localhost:3001 + - CORS_ORIGINS=https://dashboard.codenuk.com - CORS_METHODS=GET,POST,PUT,DELETE,PATCH,OPTIONS # Add this line - CORS_CREDENTIALS=true # Add this line # Database connections @@ -494,7 +494,7 @@ services: ports: - "8011:8011" environment: - - FRONTEND_URL=http://localhost:3001 + - FRONTEND_URL=https://dashboard.codenuk.com - PORT=8011 - HOST=0.0.0.0 - NODE_ENV=development @@ -641,7 +641,7 @@ services: environment: - PORT=8012 - HOST=0.0.0.0 - - FRONTEND_URL=http://localhost:3001 + - FRONTEND_URL=https://dashboard.codenuk.com - POSTGRES_HOST=postgres - POSTGRES_PORT=5432 - POSTGRES_DB=dev_pipeline @@ -653,26 +653,26 @@ services: - NODE_ENV=development - GITHUB_CLIENT_ID=Ov23liQgF14aogXVZNCR - GITHUB_CLIENT_SECRET=8bf82a29154fdccb837bc150539a2226d00b5da5 - - GITHUB_REDIRECT_URI=http://localhost:8000/api/github/auth/github/callback + - GITHUB_REDIRECT_URI=https://backend.codenuk.com/api/github/auth/github/callback - ATTACHED_REPOS_DIR=/tmp/git-repos - GIT_REPOS_BASE_DIR=/tmp/git-repos - GIT_DIFF_DIR=/tmp/git-repos/diffs - SESSION_SECRET=git-integration-secret-key-2024 - JWT_ACCESS_SECRET=access-secret-key-2024-tech4biz-secure_pipeline_2024 - - API_GATEWAY_PUBLIC_URL=http://localhost:8000 + - API_GATEWAY_PUBLIC_URL=https://backend.codenuk.com # Additional VCS OAuth URLs for gateway - BITBUCKET_CLIENT_ID=ZhdD8bbfugEUS4aL7v - BITBUCKET_CLIENT_SECRET=K3dY3PFQRJUGYwBtERpHMswrRHbmK8qw - - BITBUCKET_REDIRECT_URI=http://localhost:8000/api/vcs/bitbucket/auth/callback + - BITBUCKET_REDIRECT_URI=https://backend.codenuk.com/api/vcs/bitbucket/auth/callback - GITLAB_BASE_URL=https://gitlab.com - GITLAB_CLIENT_ID=f05b0ab3ff6d5d26e1350ccf42d6394e085e343251faa07176991355112d4348 - GITLAB_CLIENT_SECRET=gloas-a2c11ed9bd84201d7773f264cad6e86a116355d80c24a68000cebfc92ebe2411 - - GITLAB_REDIRECT_URI=http://localhost:8000/api/vcs/gitlab/auth/callback + - GITLAB_REDIRECT_URI=https://backend.codenuk.com/api/vcs/gitlab/auth/callback - GITLAB_WEBHOOK_SECRET=mywebhooksecret2025 - GITEA_BASE_URL=https://gitea.com - GITEA_CLIENT_ID=d96d7ff6-8f56-4e58-9dbb-6d692de6504c - GITEA_CLIENT_SECRET=gto_m7bn22idy35f4n4fxv7bwi7ky7w4q4mpgmwbtzhl4cinc4dpgmia - - GITEA_REDIRECT_URI=http://localhost:8000/api/vcs/gitea/auth/callback + - GITEA_REDIRECT_URI=https://backend.codenuk.com/api/vcs/gitea/auth/callback - GITEA_WEBHOOK_SECRET=mywebhooksecret2025 - PUBLIC_BASE_URL=https://a1247f5c9f93.ngrok-free.app - GITHUB_WEBHOOK_SECRET=mywebhooksecret2025 @@ -873,4 +873,3 @@ networks: # ===================================== # Self-Improving Code Generator # ===================================== - diff --git a/scripts/migrate-clean.sh b/scripts/migrate-clean.sh index f6b849b..4a99bab 100755 --- a/scripts/migrate-clean.sh +++ b/scripts/migrate-clean.sh @@ -74,7 +74,7 @@ log "✅ Core schema applied" log "🔧 Step 3: Applying service-specific migrations..." # Define migration order (dependencies first) -migration_services="user-auth template-manager requirement-processor git-integration ai-mockup-service tech-stack-selector" +migration_services="user-auth template-manager git-integration requirement-processor ai-mockup-service tech-stack-selector" # Track failed services failed_services="" diff --git a/services/api-gateway/src/server.js b/services/api-gateway/src/server.js index 16c9d44..c062093 100644 --- a/services/api-gateway/src/server.js +++ b/services/api-gateway/src/server.js @@ -72,20 +72,20 @@ global.io = io; // Service targets configuration const serviceTargets = { - USER_AUTH_URL: process.env.USER_AUTH_URL || 'http://localhost:8011', - TEMPLATE_MANAGER_URL: process.env.TEMPLATE_MANAGER_URL || 'http://localhost:8009', - TEMPLATE_MANAGER_AI_URL: process.env.TEMPLATE_MANAGER_AI_URL || 'http://localhost:8013', - GIT_INTEGRATION_URL: process.env.GIT_INTEGRATION_URL || 'http://localhost:8012', - REQUIREMENT_PROCESSOR_URL: process.env.REQUIREMENT_PROCESSOR_URL || 'http://requirement-processor:8001', - TECH_STACK_SELECTOR_URL: process.env.TECH_STACK_SELECTOR_URL || 'http://localhost:8002', - ARCHITECTURE_DESIGNER_URL: process.env.ARCHITECTURE_DESIGNER_URL || 'http://localhost:8003', - CODE_GENERATOR_URL: process.env.CODE_GENERATOR_URL || 'http://localhost:8004', - TEST_GENERATOR_URL: process.env.TEST_GENERATOR_URL || 'http://localhost:8005', - DEPLOYMENT_MANAGER_URL: process.env.DEPLOYMENT_MANAGER_URL || 'http://localhost:8006', - DASHBOARD_URL: process.env.DASHBOARD_URL || 'http://localhost:8008', - SELF_IMPROVING_GENERATOR_URL: process.env.SELF_IMPROVING_GENERATOR_URL || 'http://localhost:8007', - AI_MOCKUP_URL: process.env.AI_MOCKUP_URL || 'http://localhost:8021', - UNISON_URL: process.env.UNISON_URL || 'http://localhost:8010', + USER_AUTH_URL: process.env.USER_AUTH_URL || 'https://backend.codenuk.com', + TEMPLATE_MANAGER_URL: process.env.TEMPLATE_MANAGER_URL || 'https://backend.codenuk.com', + TEMPLATE_MANAGER_AI_URL: process.env.TEMPLATE_MANAGER_AI_URL || 'https://backend.codenuk.com', + GIT_INTEGRATION_URL: process.env.GIT_INTEGRATION_URL || 'https://backend.codenuk.com', + REQUIREMENT_PROCESSOR_URL: process.env.REQUIREMENT_PROCESSOR_URL || 'https://backend.codenuk.com', + TECH_STACK_SELECTOR_URL: process.env.TECH_STACK_SELECTOR_URL || 'https://backend.codenuk.com', + ARCHITECTURE_DESIGNER_URL: process.env.ARCHITECTURE_DESIGNER_URL || 'https://backend.codenuk.com', + CODE_GENERATOR_URL: process.env.CODE_GENERATOR_URL || 'https://backend.codenuk.com', + TEST_GENERATOR_URL: process.env.TEST_GENERATOR_URL || 'https://backend.codenuk.com', + DEPLOYMENT_MANAGER_URL: process.env.DEPLOYMENT_MANAGER_URL || 'https://backend.codenuk.com', + DASHBOARD_URL: process.env.DASHBOARD_URL || 'https://backend.codenuk.com', + SELF_IMPROVING_GENERATOR_URL: process.env.SELF_IMPROVING_GENERATOR_URL || 'https://backend.codenuk.com', + AI_MOCKUP_URL: process.env.AI_MOCKUP_URL || 'https://backend.codenuk.com', + UNISON_URL: process.env.UNISON_URL || 'https://backend.codenuk.com', }; // Log service targets for debugging @@ -1136,7 +1136,7 @@ app.use('/api/github', // Update redirect URL to use gateway port if it points to git-integration service let updatedLocation = location; if (location.includes('localhost:8012')) { - updatedLocation = location.replace('localhost:8012', 'localhost:8000'); + updatedLocation = location.replace('backend.codenuk.com', 'backend.codenuk.com'); console.log(`🔄 [GIT PROXY] Updated redirect URL: ${updatedLocation}`); } @@ -1257,7 +1257,7 @@ app.use('/api/vcs', // Update redirect URL to use gateway port if it points to git-integration service let updatedLocation = location; if (location.includes('localhost:8012')) { - updatedLocation = location.replace('localhost:8012', 'localhost:8000'); + updatedLocation = location.replace('backend.codenuk.com', 'backend.codenuk.com'); console.log(`🔄 [VCS PROXY] Updated redirect URL: ${updatedLocation}`); } @@ -1539,9 +1539,9 @@ const startServer = async () => { server.listen(PORT, '0.0.0.0', () => { console.log(`✅ API Gateway running on port ${PORT}`); console.log(`🌍 Environment: ${process.env.NODE_ENV || 'development'}`); - console.log(`📋 Health check: http://localhost:${PORT}/health`); - console.log(`📖 Gateway info: http://localhost:${PORT}/api/gateway/info`); - console.log(`🔗 WebSocket enabled on: ws://localhost:${PORT}`); + console.log(`📋 Health check: https://backend.codenuk.com/health`); + console.log(`📖 Gateway info: https://backend.codenuk.com/api/gateway/info`); + console.log(`🔗 WebSocket enabled on: wss://backend.codenuk.com`); // Log service configuration console.log('⚙️ Configured Services:'); diff --git a/services/git-integration/src/app.js b/services/git-integration/src/app.js index 17f0864..5d05e62 100644 --- a/services/git-integration/src/app.js +++ b/services/git-integration/src/app.js @@ -4,7 +4,7 @@ const helmet = require('helmet'); const session = require('express-session'); const morgan = require('morgan'); -// Import database +// Import database (uses environment variables from docker-compose.yml) const database = require('./config/database'); // Import services @@ -150,11 +150,11 @@ async function initializeServices() { // Start server app.listen(PORT, '0.0.0.0', async () => { console.log(`🚀 Git Integration Service running on port ${PORT}`); - console.log(`📊 Health check: http://localhost:${PORT}/health`); - console.log(`🔗 GitHub API: http://localhost:${PORT}/api/github`); - console.log(`📝 Commits API: http://localhost:${PORT}/api/commits`); - console.log(`🔐 OAuth API: http://localhost:${PORT}/api/oauth`); - console.log(`🪝 Enhanced Webhooks: http://localhost:${PORT}/api/webhooks`); + console.log(`📊 Health check: https://backend.codenuk.com/health`); + console.log(`🔗 GitHub API: https://backend.codenuk.com/api/github`); + console.log(`📝 Commits API: https://backend.codenuk.com/api/commits`); + console.log(`🔐 OAuth API: https://backend.codenuk.com/api/oauth`); + console.log(`🪝 Enhanced Webhooks: https://backend.codenuk.com/api/webhooks`); // Initialize services after server starts await initializeServices(); diff --git a/services/git-integration/src/config/database.js b/services/git-integration/src/config/database.js index 34ca559..6d5c835 100644 --- a/services/git-integration/src/config/database.js +++ b/services/git-integration/src/config/database.js @@ -4,19 +4,13 @@ class Database { constructor() { this.pool = new Pool({ host: process.env.POSTGRES_HOST || 'localhost', - port: process.env.POSTGRES_PORT || 5432, + port: process.env.POSTGRES_PORT || 5432, database: process.env.POSTGRES_DB || 'dev_pipeline', user: process.env.POSTGRES_USER || 'pipeline_admin', password: process.env.POSTGRES_PASSWORD || 'secure_pipeline_2024', max: 20, idleTimeoutMillis: 30000, - connectionTimeoutMillis: 2000, - }); - - // Handle pool errors - this.pool.on('error', (err) => { - console.error('❌ Database pool error:', err.message); - // Don't crash the process, just log the error + connectionTimeoutMillis: 10000, }); // Test connection on startup @@ -26,12 +20,12 @@ class Database { async testConnection() { try { const client = await this.pool.connect(); - console.log('✅ Database connected successfully'); + console.log('✅ Git Integration Database connected successfully'); client.release(); } catch (err) { - console.error('❌ Database connection failed:', err.message); - console.log('⚠️ Continuing without database connection...'); + console.error('❌ Git Integration Database connection failed:', err.message); // Don't exit the process, just log the error + // The service can still start and retry connections later } } @@ -40,12 +34,30 @@ class Database { try { const res = await this.pool.query(text, params); const duration = Date.now() - start; - console.log('📊 Query executed:', { text: text.substring(0, 50), duration, rows: res.rowCount }); + console.log('📊 Git Integration Query executed:', { + text: text.substring(0, 50) + '...', + duration, + rows: res.rowCount + }); return res; } catch (err) { - console.error('❌ Query error:', err.message); - // Return empty result instead of throwing error - return { rows: [], rowCount: 0 }; + console.error('❌ Git Integration Query error:', err.message); + throw err; + } + } + + async transaction(callback) { + const client = await this.pool.connect(); + try { + await client.query('BEGIN'); + const result = await callback(client); + await client.query('COMMIT'); + return result; + } catch (error) { + await client.query('ROLLBACK'); + throw error; + } finally { + client.release(); } } @@ -55,7 +67,7 @@ class Database { async close() { await this.pool.end(); - console.log('🔌 Database connection closed'); + console.log('🔌 Git Integration Database connection closed'); } } diff --git a/services/git-integration/src/migrations/001_github_integration.sql b/services/git-integration/src/migrations/001_github_integration.sql index ecf86aa..f049e96 100644 --- a/services/git-integration/src/migrations/001_github_integration.sql +++ b/services/git-integration/src/migrations/001_github_integration.sql @@ -25,8 +25,7 @@ CREATE TABLE IF NOT EXISTS all_repositories ( CREATE INDEX IF NOT EXISTS idx_github_repos_template_id ON all_repositories(template_id); CREATE INDEX IF NOT EXISTS idx_github_repos_owner_name ON all_repositories(owner_name); CREATE INDEX IF NOT EXISTS idx_all_repos_provider_name ON all_repositories(provider_name); -CREATE INDEX IF NOT EXISTS idx_feature_mappings_feature_id ON feature_codebase_mappings(feature_id); -CREATE INDEX IF NOT EXISTS idx_feature_mappings_repo_id ON feature_codebase_mappings(repository_id); +-- Note: feature_codebase_mappings table indexes will be created when that table is added -- Add trigger to update timestamp CREATE TRIGGER update_github_repos_updated_at BEFORE UPDATE ON all_repositories diff --git a/services/git-integration/src/migrations/003_add_user_id_to_template_refs.sql b/services/git-integration/src/migrations/003_add_user_id_to_template_refs.sql index dcdc7f1..76761b0 100644 --- a/services/git-integration/src/migrations/003_add_user_id_to_template_refs.sql +++ b/services/git-integration/src/migrations/003_add_user_id_to_template_refs.sql @@ -9,13 +9,13 @@ ALTER TABLE IF EXISTS all_repositories CREATE INDEX IF NOT EXISTS idx_github_repos_user_id ON all_repositories(user_id); CREATE INDEX IF NOT EXISTS idx_github_repos_template_user ON all_repositories(template_id, user_id); --- Add user_id to feature_codebase_mappings -ALTER TABLE IF EXISTS feature_codebase_mappings - ADD COLUMN IF NOT EXISTS user_id UUID REFERENCES users(id) ON DELETE CASCADE; +-- Add user_id to feature_codebase_mappings (commented out - table doesn't exist yet) +-- ALTER TABLE IF EXISTS feature_codebase_mappings +-- ADD COLUMN IF NOT EXISTS user_id UUID REFERENCES users(id) ON DELETE CASCADE; --- Indexes for feature_codebase_mappings -CREATE INDEX IF NOT EXISTS idx_feature_mappings_user_id ON feature_codebase_mappings(user_id); -CREATE INDEX IF NOT EXISTS idx_feature_mappings_template_user ON feature_codebase_mappings(template_id, user_id); +-- Indexes for feature_codebase_mappings (commented out - table doesn't exist yet) +-- CREATE INDEX IF NOT EXISTS idx_feature_mappings_user_id ON feature_codebase_mappings(user_id); +-- CREATE INDEX IF NOT EXISTS idx_feature_mappings_template_user ON feature_codebase_mappings(template_id, user_id); -- Note: Columns are nullable to allow backfill before enforcing NOT NULL if desired diff --git a/services/git-integration/src/migrations/010_remove_template_id.sql b/services/git-integration/src/migrations/010_remove_template_id.sql index a72ca5d..a7300ab 100644 --- a/services/git-integration/src/migrations/010_remove_template_id.sql +++ b/services/git-integration/src/migrations/010_remove_template_id.sql @@ -10,9 +10,9 @@ DROP INDEX IF EXISTS idx_feature_mappings_template_user; ALTER TABLE IF EXISTS all_repositories DROP COLUMN IF EXISTS template_id; --- Remove template_id column from feature_codebase_mappings table -ALTER TABLE IF EXISTS feature_codebase_mappings - DROP COLUMN IF EXISTS template_id; +-- Remove template_id column from feature_codebase_mappings table (commented out - table doesn't exist yet) +-- ALTER TABLE IF EXISTS feature_codebase_mappings +-- DROP COLUMN IF EXISTS template_id; -- Note: This migration removes the template_id foreign key relationships -- The tables will now rely on user_id for ownership tracking diff --git a/services/git-integration/src/migrations/017_complete_schema_from_provided_migrations.sql b/services/git-integration/src/migrations/017_complete_schema_from_provided_migrations.sql index 3719661..4e7faec 100644 --- a/services/git-integration/src/migrations/017_complete_schema_from_provided_migrations.sql +++ b/services/git-integration/src/migrations/017_complete_schema_from_provided_migrations.sql @@ -6,24 +6,25 @@ -- ============================================= -- Create table for GitHub repositories (enhanced version from provided migration) -CREATE TABLE IF NOT EXISTS all_repositories ( - id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), - template_id UUID, -- References templates(id) but table may not exist - repository_url VARCHAR(500) NOT NULL, - repository_name VARCHAR(200) NOT NULL, - owner_name VARCHAR(100) NOT NULL, - provider_name VARCHAR(50) DEFAULT 'github' NOT NULL, - branch_name VARCHAR(100) DEFAULT 'main', - is_public BOOLEAN DEFAULT true, - requires_auth BOOLEAN DEFAULT false, - last_synced_at TIMESTAMP, - sync_status VARCHAR(50) DEFAULT 'pending', - metadata JSONB, - codebase_analysis JSONB, - last_synced_commit_sha VARCHAR(64), - created_at TIMESTAMP DEFAULT NOW(), - updated_at TIMESTAMP DEFAULT NOW() -); +-- Note: Table already exists from migration 001, skipping recreation +-- CREATE TABLE IF NOT EXISTS all_repositories ( +-- id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), +-- template_id UUID, -- References templates(id) but table may not exist +-- repository_url VARCHAR(500) NOT NULL, +-- repository_name VARCHAR(200) NOT NULL, +-- owner_name VARCHAR(100) NOT NULL, +-- provider_name VARCHAR(50) DEFAULT 'github' NOT NULL, +-- branch_name VARCHAR(100) DEFAULT 'main', +-- is_public BOOLEAN DEFAULT true, +-- requires_auth BOOLEAN DEFAULT false, +-- last_synced_at TIMESTAMP, +-- sync_status VARCHAR(50) DEFAULT 'pending', +-- metadata JSONB, +-- codebase_analysis JSONB, +-- last_synced_commit_sha VARCHAR(64), +-- created_at TIMESTAMP DEFAULT NOW(), +-- updated_at TIMESTAMP DEFAULT NOW() +-- ); -- ============================================= -- Repository File Storage Tables @@ -329,8 +330,8 @@ CREATE TABLE IF NOT EXISTS diff_statistics ( -- Indexes for Performance -- ============================================= --- GitHub repositories indexes -CREATE INDEX IF NOT EXISTS idx_github_repos_template_id ON all_repositories(template_id); +-- GitHub repositories indexes (commented out - template_id column was removed) +-- CREATE INDEX IF NOT EXISTS idx_github_repos_template_id ON all_repositories(template_id); CREATE INDEX IF NOT EXISTS idx_github_repos_owner_name ON all_repositories(owner_name); CREATE INDEX IF NOT EXISTS idx_all_repos_provider_name ON all_repositories(provider_name); diff --git a/services/git-integration/src/migrations/021_cleanup_migration_conflicts.sql b/services/git-integration/src/migrations/021_cleanup_migration_conflicts.sql index 5d267fb..a51095a 100644 --- a/services/git-integration/src/migrations/021_cleanup_migration_conflicts.sql +++ b/services/git-integration/src/migrations/021_cleanup_migration_conflicts.sql @@ -199,4 +199,8 @@ BEGIN END IF; END $$; -RAISE NOTICE '🎉 Migration 021 completed - Schema conflicts resolved'; +-- Final completion notice +DO $$ +BEGIN + RAISE NOTICE '🎉 Migration 021 completed - Schema conflicts resolved'; +END $$; diff --git a/services/git-integration/src/migrations/migrate.js b/services/git-integration/src/migrations/migrate.js index 6102fcf..9572c30 100644 --- a/services/git-integration/src/migrations/migrate.js +++ b/services/git-integration/src/migrations/migrate.js @@ -12,14 +12,27 @@ async function runMigrations() { await database.testConnection(); console.log('✅ Database connected successfully'); - // Get list of migration files + // Get list of migration files (skip the tracking system as it's handled by main migration) const migrationFiles = fs.readdirSync(migrationsDir) - .filter(file => file.endsWith('.sql')) + .filter(file => file.endsWith('.sql') && file !== '000_migration_tracking_system.sql') .sort(); console.log(`📄 Found ${migrationFiles.length} migration files:`, migrationFiles); for (const migrationFile of migrationFiles) { + const migrationVersion = migrationFile.replace('.sql', ''); + + // Check if migration already applied + const existingMigration = await database.query( + 'SELECT version FROM schema_migrations WHERE version = $1 AND service = $2', + [migrationVersion, 'git-integration'] + ); + + if (existingMigration.rows.length > 0) { + console.log(`⏭️ Skipping already applied migration: ${migrationFile}`); + continue; + } + console.log(`🚀 Running migration: ${migrationFile}`); const migrationPath = path.join(migrationsDir, migrationFile); @@ -27,6 +40,13 @@ async function runMigrations() { try { await database.query(migrationSQL); + + // Record migration in main schema_migrations table + await database.query( + 'INSERT INTO schema_migrations (version, service, description) VALUES ($1, $2, $3) ON CONFLICT (version) DO NOTHING', + [migrationFile.replace('.sql', ''), 'git-integration', `Git integration migration: ${migrationFile}`] + ); + console.log(`✅ Migration ${migrationFile} completed successfully!`); } catch (err) { const message = (err && err.message) ? err.message.toLowerCase() : ''; diff --git a/services/git-integration/src/routes/github-integration.routes.js b/services/git-integration/src/routes/github-integration.routes.js index ef5205b..48e61a9 100644 --- a/services/git-integration/src/routes/github-integration.routes.js +++ b/services/git-integration/src/routes/github-integration.routes.js @@ -32,7 +32,7 @@ const generateAuthResponse = (res, repository_url, branch_name, userId) => { const rawAuthUrl = oauthService.getAuthUrl(state, userIdForAuth); console.log('🔧 [generateAuthResponse] Generated raw auth URL:', rawAuthUrl); - const gatewayBase = process.env.API_GATEWAY_PUBLIC_URL || 'http://localhost:8000'; + const gatewayBase = process.env.API_GATEWAY_PUBLIC_URL || 'https://backend.codenuk.com'; const serviceRelative = '/api/github/auth/github'; const serviceAuthUrl = `${gatewayBase}${serviceRelative}?redirect=1&state=${encodeURIComponent(state)}${userIdForAuth ? `&user_id=${encodeURIComponent(userIdForAuth)}` : ''}`; @@ -153,7 +153,7 @@ router.post('/attach-repository', async (req, res) => { const rawAuthUrl = oauthService.getAuthUrl(state, userIdForAuth); console.log('🔧 [INLINE AUTH] Generated raw auth URL:', rawAuthUrl); - const gatewayBase = process.env.API_GATEWAY_PUBLIC_URL || 'http://localhost:8000'; + const gatewayBase = process.env.API_GATEWAY_PUBLIC_URL || 'https://backend.codenuk.com'; const serviceRelative = '/api/github/auth/github'; const serviceAuthUrl = `${gatewayBase}${serviceRelative}?redirect=1&state=${encodeURIComponent(state)}${userIdForAuth ? `&user_id=${encodeURIComponent(userIdForAuth)}` : ''}`; @@ -207,7 +207,7 @@ router.post('/attach-repository', async (req, res) => { const state = `${stateBase}|uid=${userIdForAuth || ''}|repo=${encodedRepoUrl}|branch=${encodedBranchName}`; const rawAuthUrl = oauthService.getAuthUrl(state, userIdForAuth); - const gatewayBase = process.env.API_GATEWAY_PUBLIC_URL || 'http://localhost:8000'; + const gatewayBase = process.env.API_GATEWAY_PUBLIC_URL || 'https://backend.codenuk.com'; const serviceRelative = '/api/github/auth/github'; const serviceAuthUrl = `${gatewayBase}${serviceRelative}?redirect=1&state=${encodeURIComponent(state)}${userIdForAuth ? `&user_id=${encodeURIComponent(userIdForAuth)}` : ''}`; diff --git a/services/git-integration/src/routes/github-oauth.js b/services/git-integration/src/routes/github-oauth.js index 5840fcd..6f0e4b9 100644 --- a/services/git-integration/src/routes/github-oauth.js +++ b/services/git-integration/src/routes/github-oauth.js @@ -116,7 +116,7 @@ router.get('/auth/github/callback', async (req, res) => { // Attempt analysis and sync with fallback const codebaseAnalysis = await githubService.analyzeCodebase(owner, repo, actualBranch, false); const insertQuery = ` - INSERT INTO github_repositories ( + INSERT INTO all_repositories ( repository_url, repository_name, owner_name, branch_name, is_public, metadata, codebase_analysis, sync_status, requires_auth, user_id @@ -140,7 +140,7 @@ router.get('/auth/github/callback', async (req, res) => { // Try to sync const downloadResult = await githubService.syncRepositoryWithFallback(owner, repo, actualBranch, repositoryRecord.id, repositoryData.visibility !== 'private'); const finalSyncStatus = downloadResult.success ? 'synced' : 'error'; - await database.query('UPDATE github_repositories SET sync_status = $1, updated_at = NOW() WHERE id = $2', [finalSyncStatus, repositoryRecord.id]); + await database.query('UPDATE all_repositories SET sync_status = $1, updated_at = NOW() WHERE id = $2', [finalSyncStatus, repositoryRecord.id]); autoAttach = { repository_id: repositoryRecord.id, sync_status: finalSyncStatus }; } } @@ -149,7 +149,7 @@ router.get('/auth/github/callback', async (req, res) => { } // Redirect back to frontend if configured - const frontendUrl = process.env.FRONTEND_URL || 'http://localhost:3000'; + const frontendUrl = process.env.FRONTEND_URL || 'https://dashboard.codenuk.com'; try { const redirectUrl = `${frontendUrl}/project-builder?github_connected=1&user=${encodeURIComponent(githubUser.login)}${autoAttach ? `&repo_attached=1&repository_id=${encodeURIComponent(autoAttach.repository_id)}&sync_status=${encodeURIComponent(autoAttach.sync_status)}` : ''}`; return res.redirect(302, redirectUrl); diff --git a/services/git-integration/src/services/bitbucket-oauth.js b/services/git-integration/src/services/bitbucket-oauth.js index 579bc9a..8666cbf 100644 --- a/services/git-integration/src/services/bitbucket-oauth.js +++ b/services/git-integration/src/services/bitbucket-oauth.js @@ -5,7 +5,7 @@ class BitbucketOAuthService { constructor() { this.clientId = process.env.BITBUCKET_CLIENT_ID; this.clientSecret = process.env.BITBUCKET_CLIENT_SECRET; - this.redirectUri = process.env.BITBUCKET_REDIRECT_URI || 'http://localhost:8012/api/vcs/bitbucket/auth/callback'; + this.redirectUri = process.env.BITBUCKET_REDIRECT_URI || 'https://backend.codenuk.com/api/vcs/bitbucket/auth/callback'; } getAuthUrl(state) { diff --git a/services/git-integration/src/services/enhanced-webhook.service.js b/services/git-integration/src/services/enhanced-webhook.service.js index 9d3c9dd..df8f446 100644 --- a/services/git-integration/src/services/enhanced-webhook.service.js +++ b/services/git-integration/src/services/enhanced-webhook.service.js @@ -323,7 +323,7 @@ class EnhancedWebhookService { } const query = ` - SELECT id FROM github_repositories + SELECT id FROM all_repositories WHERE owner_name = $1 AND repository_name = $2 LIMIT 1 `; @@ -361,7 +361,7 @@ class EnhancedWebhookService { if (afterSha) { const query = ` - UPDATE github_repositories + UPDATE all_repositories SET last_synced_at = NOW(), last_synced_commit_sha = $2, sync_status = 'completed' diff --git a/services/git-integration/src/services/gitea-oauth.js b/services/git-integration/src/services/gitea-oauth.js index 5add638..0775d95 100644 --- a/services/git-integration/src/services/gitea-oauth.js +++ b/services/git-integration/src/services/gitea-oauth.js @@ -8,7 +8,7 @@ class GiteaOAuthService { this.clientId = process.env.GITEA_CLIENT_ID; this.clientSecret = process.env.GITEA_CLIENT_SECRET; this.baseUrl = (process.env.GITEA_BASE_URL || 'https://gitea.com').replace(/\/$/, ''); - this.redirectUri = process.env.GITEA_REDIRECT_URI || 'http://localhost:8012/api/vcs/gitea/auth/callback'; + this.redirectUri = process.env.GITEA_REDIRECT_URI || 'https://backend.codenuk.com/api/vcs/gitea/auth/callback'; } getAuthUrl(state) { diff --git a/services/git-integration/src/services/github-integration.service.js b/services/git-integration/src/services/github-integration.service.js index b6b6f52..82e70e4 100644 --- a/services/git-integration/src/services/github-integration.service.js +++ b/services/git-integration/src/services/github-integration.service.js @@ -566,7 +566,7 @@ class GitHubIntegrationService { // Persist last synced commit try { await database.query( - 'UPDATE github_repositories SET last_synced_commit_sha = $1, last_synced_at = NOW(), updated_at = NOW() WHERE id = $2', + 'UPDATE all_repositories SET last_synced_commit_sha = $1, last_synced_at = NOW(), updated_at = NOW() WHERE id = $2', [afterSha || beforeSha || null, repositoryId] ); } catch (_) {} diff --git a/services/git-integration/src/services/github-oauth.js b/services/git-integration/src/services/github-oauth.js index 419f4e4..3cb02ef 100644 --- a/services/git-integration/src/services/github-oauth.js +++ b/services/git-integration/src/services/github-oauth.js @@ -6,7 +6,7 @@ class GitHubOAuthService { constructor() { this.clientId = process.env.GITHUB_CLIENT_ID; this.clientSecret = process.env.GITHUB_CLIENT_SECRET; - this.redirectUri = process.env.GITHUB_REDIRECT_URI || 'http://localhost:8000/api/github/auth/github/callback'; + this.redirectUri = process.env.GITHUB_REDIRECT_URI || 'https://backend.codenuk.com/api/github/auth/github/callback'; if (!this.clientId || !this.clientSecret) { console.warn('GitHub OAuth not configured. Only public repositories will be accessible.'); @@ -82,7 +82,7 @@ class GitHubOAuthService { const query = ` INSERT INTO github_user_tokens (access_token, github_username, github_user_id, scopes, expires_at, user_id, is_primary) VALUES ($1, $2, $3, $4, $5, $6, $7) - ON CONFLICT (user_id, github_username) + ON CONFLICT (user_id, github_username) WHERE user_id IS NOT NULL DO UPDATE SET access_token = $1, github_user_id = $3, diff --git a/services/git-integration/src/services/webhook.service.js b/services/git-integration/src/services/webhook.service.js index d399e6c..4dbcabb 100644 --- a/services/git-integration/src/services/webhook.service.js +++ b/services/git-integration/src/services/webhook.service.js @@ -74,7 +74,7 @@ class WebhookService { // Find repository_id in our DB if attached const repoLookup = await database.query( - 'SELECT id FROM github_repositories WHERE owner_name = $1 AND repository_name = $2 ORDER BY created_at DESC LIMIT 1', + 'SELECT id FROM all_repositories WHERE owner_name = $1 AND repository_name = $2 ORDER BY created_at DESC LIMIT 1', [repoOwner, repoName] ); const repoId = repoLookup.rows[0]?.id || null; @@ -150,7 +150,7 @@ class WebhookService { try { // Mark syncing await database.query( - 'UPDATE github_repositories SET sync_status = $1, updated_at = NOW() WHERE id = $2', + 'UPDATE all_repositories SET sync_status = $1, updated_at = NOW() WHERE id = $2', ['syncing', repoId] ); @@ -169,14 +169,14 @@ class WebhookService { } await database.query( - 'UPDATE github_repositories SET sync_status = $1, last_synced_at = NOW(), updated_at = NOW() WHERE id = $2', + 'UPDATE all_repositories SET sync_status = $1, last_synced_at = NOW(), updated_at = NOW() WHERE id = $2', [downloadResult.success ? 'synced' : 'error', repoId] ); } catch (syncErr) { console.warn('Auto-sync failed:', syncErr.message); try { await database.query( - 'UPDATE github_repositories SET sync_status = $1, updated_at = NOW() WHERE id = $2', + 'UPDATE all_repositories SET sync_status = $1, updated_at = NOW() WHERE id = $2', ['error', repoId] ); } catch (_) {} @@ -190,7 +190,7 @@ class WebhookService { // Find repositories in our database that match this GitHub repository const query = ` SELECT gr.*, rs.storage_status, rs.local_path - FROM github_repositories gr + FROM all_repositories gr LEFT JOIN repository_storage rs ON gr.id = rs.repository_id WHERE gr.owner_name = $1 AND gr.repository_name = $2 `; @@ -203,7 +203,7 @@ class WebhookService { // Update last synced timestamp for (const repo of result.rows) { await database.query( - 'UPDATE github_repositories SET last_synced_at = NOW(), updated_at = NOW() WHERE id = $1', + 'UPDATE all_repositories SET last_synced_at = NOW(), updated_at = NOW() WHERE id = $1', [repo.id] ); diff --git a/services/unison/ENDPOINT_ANALYSIS.md b/services/unison/ENDPOINT_ANALYSIS.md index 8ce2e54..220b687 100644 --- a/services/unison/ENDPOINT_ANALYSIS.md +++ b/services/unison/ENDPOINT_ANALYSIS.md @@ -5,7 +5,7 @@ - **Version**: 1.0.0 - **Port**: 8014 (external) → 8010 (internal) - **Status**: ✅ OPERATIONAL -- **Base URL**: `http://localhost:8014` +- **Base URL**: `https://backend.codenuk.com` ## 🔗 Complete Endpoint Inventory @@ -153,7 +153,7 @@ ### Unified Recommendation Request ```bash -curl -X POST http://localhost:8014/api/recommendations/unified \ +curl -X POST https://backend.codenuk.com/api/recommendations/unified \ -H "Content-Type: application/json" \ -d '{ "domain": "e-commerce", @@ -164,12 +164,12 @@ curl -X POST http://localhost:8014/api/recommendations/unified \ ### Health Check Request ```bash -curl http://localhost:8014/health +curl https://backend.codenuk.com/health ``` ### Tech Stack Only Request ```bash -curl "http://localhost:8014/api/recommendations/tech-stack?domain=web%20development&budget=500" +curl "https://backend.codenuk.com/api/recommendations/tech-stack?domain=web%20development&budget=500" ``` ## ✅ Summary diff --git a/services/unison/README.md b/services/unison/README.md index 5da923d..4fb9fa0 100644 --- a/services/unison/README.md +++ b/services/unison/README.md @@ -113,7 +113,7 @@ The service uses a `config.env` file for environment variables. This file is alr ### Base URL ``` -http://localhost:8010 +https://backend.codenuk.com ``` ### Endpoints @@ -198,7 +198,7 @@ Service information and available endpoints. ### Basic Unified Recommendation ```bash -curl -X POST http://localhost:8010/api/recommendations/unified \ +curl -X POST https://backend.codenuk.com/api/recommendations/unified \ -H "Content-Type: application/json" \ -d '{ "domain": "e-commerce", @@ -210,7 +210,7 @@ curl -X POST http://localhost:8010/api/recommendations/unified \ ### With Template ID ```bash -curl -X POST http://localhost:8010/api/recommendations/unified \ +curl -X POST https://backend.codenuk.com/api/recommendations/unified \ -H "Content-Type: application/json" \ -d '{ "domain": "startup", @@ -224,25 +224,25 @@ curl -X POST http://localhost:8010/api/recommendations/unified \ ### Tech Stack Only ```bash -curl "http://localhost:8010/api/recommendations/tech-stack?domain=web%20development&budget=500" +curl "https://backend.codenuk.com/api/recommendations/tech-stack?domain=web%20development&budget=500" ``` ### Template Only ```bash -curl "http://localhost:8010/api/recommendations/template/123e4567-e89b-12d3-a456-426614174000?force_refresh=true" +curl "https://backend.codenuk.com/api/recommendations/template/123e4567-e89b-12d3-a456-426614174000?force_refresh=true" ``` ## 🏥 Health Monitoring ### Health Check ```bash -curl http://localhost:8010/health +curl https://backend.codenuk.com/health ``` ### Detailed Health Check ```bash -curl http://localhost:8010/health/detailed +curl https://backend.codenuk.com/health/detailed ``` ## 📊 Response Schema diff --git a/services/unison/unison_api.json b/services/unison/unison_api.json index d30dbcc..97e6026 100644 --- a/services/unison/unison_api.json +++ b/services/unison/unison_api.json @@ -8,7 +8,7 @@ "variable": [ { "key": "baseUrl", - "value": "http://localhost:8010", + "value": "https://backend.codenuk.com", "type": "string", "description": "Base URL for Unison service" }, diff --git a/services/user-auth/README-EMAIL-SETUP.md b/services/user-auth/README-EMAIL-SETUP.md index 69a1e35..f279f47 100644 --- a/services/user-auth/README-EMAIL-SETUP.md +++ b/services/user-auth/README-EMAIL-SETUP.md @@ -97,7 +97,7 @@ docker-compose logs user-auth ### 2. Test Registration -1. Visit `http://localhost:3001/signup` +1. Visit `https://dashboard.codenuk.com/signup` 2. Register a new user 3. Check logs for email status diff --git a/services/user-auth/env.example b/services/user-auth/env.example index 8c3a53a..7891d21 100644 --- a/services/user-auth/env.example +++ b/services/user-auth/env.example @@ -16,8 +16,8 @@ GMAIL_APP_PASSWORD=your-app-password # Service Configuration PORT=8011 NODE_ENV=development -FRONTEND_URL=http://localhost:3000 -AUTH_PUBLIC_URL=http://localhost:8011 +FRONTEND_URL=https://dashboard.codenuk.com +AUTH_PUBLIC_URL=https://backend.codenuk.com # Database Configuration POSTGRES_HOST=postgres diff --git a/services/user-auth/src/app.js b/services/user-auth/src/app.js index 4ce7da6..632d198 100644 --- a/services/user-auth/src/app.js +++ b/services/user-auth/src/app.js @@ -96,7 +96,7 @@ app.get('/', (req, res) => { message: 'User Authentication Service - JWT-based auth with feature preferences', version: '1.0.0', documentation: { - base_url: `http://localhost:${PORT}`, + base_url: `https://backend.codenuk.com`, endpoints: { health: '/health', auth: '/api/auth', diff --git a/services/user-auth/src/services/serviceClient.js b/services/user-auth/src/services/serviceClient.js index 24a15db..fd68d86 100644 --- a/services/user-auth/src/services/serviceClient.js +++ b/services/user-auth/src/services/serviceClient.js @@ -2,7 +2,7 @@ const axios = require('axios'); class ServiceClient { constructor() { - this.templateManagerUrl = process.env.TEMPLATE_MANAGER_URL || 'http://localhost:8009'; + this.templateManagerUrl = process.env.TEMPLATE_MANAGER_URL || 'https://backend.codenuk.com'; } async getCustomFeatures(status, limit = 50, offset = 0, authToken) { diff --git a/services/web-dashboard/README.md b/services/web-dashboard/README.md index b87cb00..59646e6 100644 --- a/services/web-dashboard/README.md +++ b/services/web-dashboard/README.md @@ -9,7 +9,7 @@ In the project directory, you can run: ### `npm start` Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. +Open [https://dashboard.codenuk.com](https://dashboard.codenuk.com) to view it in the browser. The page will reload if you make edits.\ You will also see any lint errors in the console. diff --git a/services/web-dashboard/src/components/project-builder-backup-20250726-083537/ArchitectureDesigner.js b/services/web-dashboard/src/components/project-builder-backup-20250726-083537/ArchitectureDesigner.js index bc49b9f..3470de5 100644 --- a/services/web-dashboard/src/components/project-builder-backup-20250726-083537/ArchitectureDesigner.js +++ b/services/web-dashboard/src/components/project-builder-backup-20250726-083537/ArchitectureDesigner.js @@ -30,7 +30,7 @@ export default function ArchitectureDesigner() { console.log('🏗️ Generating architecture with data:', techStackRecommendations); - const response = await fetch('http://localhost:8003/api/v1/design-architecture', { + const response = await fetch('https://backend.codenuk.com/api/v1/design-architecture', { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/services/web-dashboard/src/components/project-builder-backup-20250726-083537/BusinessQuestionsScreen.js b/services/web-dashboard/src/components/project-builder-backup-20250726-083537/BusinessQuestionsScreen.js index 3921fde..24fc511 100644 --- a/services/web-dashboard/src/components/project-builder-backup-20250726-083537/BusinessQuestionsScreen.js +++ b/services/web-dashboard/src/components/project-builder-backup-20250726-083537/BusinessQuestionsScreen.js @@ -26,7 +26,7 @@ // return; // } -// const response = await fetch('http://localhost:8001/api/v1/generate-business-questions', { +// const response = await fetch('https://backend.codenuk.com/api/v1/generate-business-questions', { // method: 'POST', // headers: { // 'Content-Type': 'application/json', @@ -102,7 +102,7 @@ // console.log('🚀 Calling tech stack selector with:', completeData); -// const response = await fetch('http://localhost:8002/api/v1/select', { +// const response = await fetch('https://backend.codenuk.com/api/v1/select', { // method: 'POST', // headers: { // 'Content-Type': 'application/json', @@ -279,7 +279,7 @@ export default function BusinessQuestionsScreen() { console.log('🚀 Sending feature data for business questions:', aiFeature); // Call requirement processor to generate business questions - const response = await fetch('http://localhost:8001/api/v1/generate-business-questions', { + const response = await fetch('https://backend.codenuk.com/api/v1/generate-business-questions', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -361,7 +361,7 @@ export default function BusinessQuestionsScreen() { console.log('🚀 Sending complete data to tech stack selector:', completeData); // Call enhanced tech stack selector directly - const response = await fetch('http://localhost:8002/api/v1/select', { + const response = await fetch('https://backend.codenuk.com/api/v1/select', { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/services/web-dashboard/src/components/project-builder/ArchitectureDesigner.js b/services/web-dashboard/src/components/project-builder/ArchitectureDesigner.js index c62d5a5..d1c44aa 100644 --- a/services/web-dashboard/src/components/project-builder/ArchitectureDesigner.js +++ b/services/web-dashboard/src/components/project-builder/ArchitectureDesigner.js @@ -34,7 +34,7 @@ export default function ArchitectureDesigner() { console.log('🏗️ Generating architecture with data:', techStackRecommendations); - const response = await fetch('http://localhost:8003/api/v1/design-architecture', { + const response = await fetch('https://backend.codenuk.com/api/v1/design-architecture', { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/services/web-dashboard/src/components/project-builder/BusinessQuestionsScreen.js b/services/web-dashboard/src/components/project-builder/BusinessQuestionsScreen.js index 078098d..7aec7fc 100644 --- a/services/web-dashboard/src/components/project-builder/BusinessQuestionsScreen.js +++ b/services/web-dashboard/src/components/project-builder/BusinessQuestionsScreen.js @@ -121,7 +121,7 @@ export default function BusinessQuestionsScreen() { console.log('🚀 Sending comprehensive system data to tech stack selector:', completeData); // Call enhanced tech stack selector directly - const response = await fetch('http://localhost:8002/api/v1/select', { + const response = await fetch('https://backend.codenuk.com/api/v1/select', { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/services/web-dashboard/src/components/project-builder/CodeGenerationFlow.js b/services/web-dashboard/src/components/project-builder/CodeGenerationFlow.js index 08b500b..562d142 100644 --- a/services/web-dashboard/src/components/project-builder/CodeGenerationFlow.js +++ b/services/web-dashboard/src/components/project-builder/CodeGenerationFlow.js @@ -72,7 +72,7 @@ export default function CodeGenerationFlow() { try { // First, send project data to code-generator for session storage - const setupResponse = await fetch('http://localhost:8004/api/v1/setup-generation', { + const setupResponse = await fetch('https://backend.codenuk.com/api/v1/setup-generation', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ @@ -90,7 +90,7 @@ export default function CodeGenerationFlow() { // Start Server-Sent Events stream const eventSource = new EventSource( - `http://localhost:8004/api/v1/generate-stream/${architectureData.project_metadata.project_id}` + `https://backend.codenuk.com/api/v1/generate-stream/${architectureData.project_metadata.project_id}` ); eventSource.onmessage = (event) => { diff --git a/services/web-dashboard/src/services/api.js b/services/web-dashboard/src/services/api.js index 7dd0d18..3bd98fb 100644 --- a/services/web-dashboard/src/services/api.js +++ b/services/web-dashboard/src/services/api.js @@ -2,7 +2,7 @@ // // Configure API client for requirement processor // const apiClient = axios.create({ -// baseURL: 'http://localhost:8001', // Direct to requirement processor +// baseURL: 'https://backend.codenuk.com', // Direct to requirement processor // timeout: 30000, // headers: { // 'Content-Type': 'application/json', @@ -11,7 +11,7 @@ // // Configure API client for Template-Manager service // const templateApiClient = axios.create({ -// baseURL: 'http://localhost:8009', // Direct to template-manager +// baseURL: 'https://backend.codenuk.com', // Direct to template-manager // timeout: 30000, // headers: { // 'Content-Type': 'application/json',