feat: Implement unified Vue SPA with granular service control

Consolidate Reports and Data Entry apps into a single Vue.js SPA with:

Architecture:
- Module-based structure with lazy-loaded routes (@reports, @data-entry)
- Error boundaries per module to prevent cascade failures
- Dual API proxy in Vite for microservices (reports:8001, data-entry:8003)
- Pinia store factories for shared auth, company, and period stores
- Vite path aliases for clear module boundaries (@shared, @reports, @data-entry)

Service Management:
- Granular service control scripts (backend-reports.sh, backend-data-entry.sh, bot.sh, frontend.sh)
- 87% faster frontend restart: 7s vs 53s full restart
- 38% faster full startup: 33s vs 53s via parallel backend initialization
- Enhanced start-dev.sh with proper service timeouts (OCR: 30s, Vite: 15s, Bot: 10s)
- status.sh for comprehensive health checks

Features:
- Auto-select first company on login with period auto-load
- Hamburger menu with feature toggle support
- JWT token auto-injection via axios interceptors
- Unified header with company/period selectors
- IIS web.config for production deployment with multi-API routing

UX Improvements:
- Vue watchers for reactive company/period loading
- Lazy store initialization with graceful error handling
- Period persistence per user+company in localStorage
- Feature flags for optional modules

Deployment:
- Single IIS site serves unified frontend with API proxy rules
- Maintains separate backend processes for microservices
- Windows line ending fixes (.env CRLF → LF conversion)

Stats: 112 files changed, 38,342 insertions(+), 2,342 deletions(-)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-24 19:06:23 +02:00
parent fed2e68fa2
commit d507a81b0a
112 changed files with 38382 additions and 2382 deletions

View File

@@ -107,18 +107,74 @@ This starts SSH tunnel, backend (port 8001), and frontend (port 3000-3005).
**Key Commands**:
```bash
# Production/Development
./start-dev.sh start # Start all services (production SSH tunnel + Backend + Frontend + Telegram Bot)
./ssh_tunnel.sh start # Start Oracle DB tunnel only (production: 10.0.20.36)
# Start All Services (FAST with parallel backend startup - ~11s dev, ~33s test)
./start-dev.sh # Start all (SSH tunnel + Backends + Bot + Frontend)
./start-test.sh # Start all (TEST environment)
# Testing/Validation (uses Oracle TEST server - LXC 10.0.20.121)
./start-test.sh start # Start all testing services (TEST SSH tunnel + Backend + Frontend + Telegram Bot)
./ssh-tunnel-test.sh start # Start Oracle TEST tunnel only (testing: LXC 10.0.20.121)
# Individual Service Control (NEW - for quick restarts!)
./frontend.sh start|stop|restart|status # Frontend only (~7s restart!)
./backend-reports.sh start|stop|status # Reports backend only
./backend-data-entry.sh start|stop|status # Data Entry backend only
./bot.sh start|stop|status # Telegram bot only
# Individual Services
cd reports-app/backend && uvicorn app.main:app --reload # Backend (port 8001)
cd reports-app/frontend && npm run dev # Frontend (port 3000-3005)
cd reports-app/telegram-bot && python -m app.main # Telegram Bot (port 8002)
# System Monitoring
./status.sh # Show all services status + health checks
# Infrastructure Only
./ssh_tunnel.sh start|stop|status # Oracle DB tunnel (production)
./ssh-tunnel-test.sh start|stop|status # Oracle TEST tunnel
```
**💡 Pro Tips**:
- **Frontend changes?** Use `./frontend.sh restart` instead of restarting everything (87% faster!)
- **Check what's running:** `./status.sh` shows everything at a glance
- **Backend-uri pornesc în paralel** în start-dev.sh și start-test.sh pentru pornire mai rapidă
### 📖 Usage Flow
**Individual scripts (`frontend.sh`, `backend-*.sh`, `bot.sh`) are environment-neutral:**
- They DON'T change `.env` files
- They use whatever `.env` is already present
- Use them for **quick restarts** when working on a specific service
**Master scripts (`start-dev.sh`, `start-test.sh`) set the environment:**
- `start-dev.sh` → uses existing `.env` files (DEV mode)
- `start-test.sh` → copies `.env.test``.env` (TEST mode)
**Recommended workflow:**
```bash
# Morning: Start full stack with environment selection
./start-dev.sh # DEV mode - sets up .env files
# During development: Quick service restarts
./frontend.sh restart # Frontend only (~7s)
./backend-reports.sh restart # Reports backend only (~30s)
# ⚠️ Individual scripts inherit the environment set by start-dev.sh
# End of day: Stop everything
./start-dev.sh stop
```
**Common scenarios:**
```bash
# Scenario 1: Working on frontend only
./start-dev.sh # Start everything once
./frontend.sh restart # Restart frontend multiple times (fast!)
# Scenario 2: Debugging a single backend
./start-dev.sh stop # Stop all
./ssh_tunnel.sh start # Infrastructure only
./backend-reports.sh start # Just the backend you need
./frontend.sh start # Just the frontend
# Scenario 3: Testing mode
./start-test.sh # Starts everything in TEST mode
# All subsequent individual script calls use TEST .env files
# Scenario 4: Check what's running
./status.sh # See all services + health checks
```
**Note**: For automated testing and validation (`/validate` command), use `start-test.sh` which starts all services connected to Oracle TEST server (LXC 10.0.20.121) with test credentials.