Initial commit: ROA2WEB - FastAPI + Vue.js + Telegram Bot

Modern ERP Reports Application with microservices architecture

Tech Stack:
- Backend: FastAPI + python-oracledb (Oracle DB integration)
- Frontend: Vue.js 3 + PrimeVue + Vite
- Telegram Bot: python-telegram-bot + SQLite
- Infrastructure: Shared database pool, JWT authentication, SSH tunnel

Features:
- FastAPI backend with async Oracle connection pool
- Vue.js 3 responsive frontend with PrimeVue components
- Telegram bot alternative interface
- Microservices architecture with shared components
- Complete deployment support (Linux Docker + Windows IIS)
- Comprehensive testing (Playwright E2E + pytest)

Repository Structure:
- reports-app/ - Main application (backend, frontend, telegram-bot)
- shared/ - Shared components (database pool, auth, utils)
- deployment/ - Deployment scripts (Linux & Windows)
- docs/ - Project documentation
- security/ - Security scanning and git hooks
This commit is contained in:
2025-10-25 14:55:08 +03:00
commit 6b13ffa183
237 changed files with 70035 additions and 0 deletions

View File

@@ -0,0 +1,138 @@
/**
* Global setup for real API integration tests
* Ensures SSH tunnel and backend services are running
*/
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default async function globalSetup() {
console.log('🔧 Setting up real API integration test environment...');
// Root directory for reference if needed later
// const rootDir = path.resolve(__dirname, '../../../../../..');
try {
// Check if SSH tunnel is running by testing Oracle port
console.log('📡 Checking SSH tunnel status...');
try {
const response = await fetch('http://localhost:8000/health', { timeout: 5000 });
const health = await response.json();
if (health.database === 'connected') {
console.log('✅ SSH tunnel appears to be working (database connected)');
} else {
console.log('⚠️ Database not connected - SSH tunnel may need to be started manually');
}
} catch (error) {
console.log('⚠️ Could not check tunnel status - continuing anyway');
}
// Check backend health
console.log('🏥 Checking backend health...');
try {
const healthResponse = await fetch('http://localhost:8000/health', {
timeout: 10000
});
if (!healthResponse.ok) {
throw new Error(`Backend health check failed: ${healthResponse.status}`);
}
const healthData = await healthResponse.json();
console.log('✅ Backend health check passed:', healthData);
} catch (error) {
console.error('❌ Backend health check failed:', error.message);
throw new Error('Backend is not available for integration tests');
}
// Check frontend availability
console.log('🌐 Checking frontend availability...');
try {
const frontendResponse = await fetch('http://localhost:3001', {
timeout: 10000
});
if (!frontendResponse.ok) {
throw new Error(`Frontend not available: ${frontendResponse.status}`);
}
console.log('✅ Frontend is available');
} catch (error) {
console.error('❌ Frontend availability check failed:', error.message);
throw new Error('Frontend is not available for integration tests');
}
// Validate environment variables
console.log('🔐 Validating environment configuration...');
const requiredEnvVars = [
'ORACLE_USER',
'ORACLE_PASSWORD',
'ORACLE_HOST',
'ORACLE_PORT',
'ORACLE_SID'
];
const missingVars = requiredEnvVars.filter(varName => !process.env[varName]);
if (missingVars.length > 0) {
console.warn('⚠️ Missing environment variables:', missingVars.join(', '));
console.log(' Some tests may use default values');
} else {
console.log('✅ All required environment variables are set');
}
// Test database connectivity through backend
console.log('🗄️ Testing database connectivity...');
try {
const dbTestResponse = await fetch('http://localhost:8000/api/companies', {
timeout: 15000
});
if (dbTestResponse.ok) {
const companies = await dbTestResponse.json();
console.log(`✅ Database connectivity verified (${companies.length} companies found)`);
// Check if ROMFAST is available
const romfast = companies.find(c => c.id_firma === 'ROMFAST');
if (romfast) {
console.log('✅ ROMFAST company data available for testing');
} else {
console.warn('⚠️ ROMFAST company not found in test data');
}
} else {
console.warn('⚠️ Database connectivity test returned:', dbTestResponse.status);
}
} catch (error) {
console.warn('⚠️ Database connectivity test failed:', error.message);
console.log(' Tests will proceed but may fail if database is not accessible');
}
console.log('🎯 Global setup completed successfully');
// Store setup metadata for tests
global.__INTEGRATION_SETUP__ = {
timestamp: new Date().toISOString(),
backend: 'http://localhost:8000',
frontend: 'http://localhost:3001',
sshTunnelActive: true,
environmentValidated: true
};
} catch (error) {
console.error('❌ Global setup encountered error:', error.message);
console.log(' Continuing with tests - they may fail if services are not available');
// Don't fail setup - let individual tests handle service unavailability
global.__INTEGRATION_SETUP__ = {
timestamp: new Date().toISOString(),
backend: 'http://localhost:8000',
frontend: 'http://localhost:3001',
sshTunnelActive: false,
environmentValidated: false,
setupError: error.message
};
}
}