chore: Remove obsolete microservices directories and update all references

- Delete data-entry-app/ (1.6GB), reports-app/ (447MB), .auto-build-data/
- Saved ~1.4GB disk space (64% reduction: 2.2GB → 845MB)

Updated references across 38 files:
- .claude/rules/ paths: backend/modules/, src/modules/
- .claude/commands/validate.md: all validation paths
- docs/ (13 files): data-entry, telegram, README, CLAUDE.md
- scripts/ (3 files): backup-secrets, restore-secrets, test-docker
- security/ (2 files): git_cleanup, SECURITY_PROCEDURES
- deployment/ & shared/: updated all stale comments

All paths now reflect ultrathin monolith architecture:
- Backend: backend/modules/{reports,data_entry,telegram}/
- Frontend: src/modules/{reports,data-entry}/
- Shared: shared/{auth,database,routes}/

🤖 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-30 12:08:20 +02:00
parent c5e051ad80
commit 9008876b16
33 changed files with 1300 additions and 125 deletions

View File

@@ -173,7 +173,7 @@ shared/
└── cache/
└── redis_client.py ⚠️ MODIFY - Use real tenant_id (not "default")
reports-app/backend/
backend/
├── app/
│ ├── main.py ⚠️ MODIFY - Initialize MultiTenantPoolManager
│ └── routers/
@@ -753,7 +753,7 @@ CREATE INDEX IF NOT EXISTS idx_audit_tenant ON audit_logs(tenant_id);
```
7. **Add background task pentru health monitoring**
- **Fișier:** `reports-app/backend/app/main.py`
- **Fișier:** `backend/app/main.py`
- **Task:** Run every 60 seconds
```python
async def monitor_ssh_tunnels():
@@ -824,7 +824,7 @@ CREATE INDEX IF NOT EXISTS idx_audit_tenant ON audit_logs(tenant_id);
```
2. **Update login endpoint să determine tenant_id**
- **Fișier:** `reports-app/backend/app/main.py` (auth router)
- **Fișier:** `backend/app/main.py` (auth router)
- **Logica:**
- Check `tenant_users` table pentru user_id
- Dacă user are access la multiple tenants, return primul (default)
@@ -921,7 +921,7 @@ CREATE INDEX IF NOT EXISTS idx_audit_tenant ON audit_logs(tenant_id);
- **Flow:** AuthMiddleware decode JWT → TenantMiddleware validate tenant access
5. **Update toate router-urile să folosească tenant_id din request.state**
- **Fișiere:** `reports-app/backend/app/routers/*.py`
- **Fișiere:** `backend/app/routers/*.py`
- **Pattern:**
```python
# Înainte (single-tenant)
@@ -945,7 +945,7 @@ CREATE INDEX IF NOT EXISTS idx_audit_tenant ON audit_logs(tenant_id);
```
6. **Update Telegram bot pentru tenant support**
- **Fișier:** `reports-app/telegram-bot/app/auth/linking.py`
- **Fișier:** `backend/modules/telegram/app/auth/linking.py`
- **Modificări:**
- La linking, salvează și `tenant_id` în SQLite
- JWT token include `tenant_id`
@@ -1590,13 +1590,13 @@ locust -f shared/tests/load/test_multi_tenant_load.py --host=http://localhost:80
expdp username/password@ROA directory=BACKUP dumpfile=pre_migration.dmp
# Backup existing .env files
cp reports-app/backend/.env reports-app/backend/.env.backup
cp backend/.env backend/.env.backup
```
- [ ] **Document current single-tenant config**
```bash
# Save current credentials
cat reports-app/backend/.env > docs/pre_migration_env.txt
cat backend/.env > docs/pre_migration_env.txt
# Save current SSH tunnel config
./ssh-tunnel-prod.sh status > docs/pre_migration_ssh.txt
@@ -1795,7 +1795,7 @@ python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().
DB_ENCRYPTION_KEY=$(cat .encryption_key)
# 3. Update .env
cat >> reports-app/backend/.env << EOF
cat >> backend/.env << EOF
# Tenant Configuration
TENANT_DB_URL=sqlite:///data/tenant_config.db
DB_ENCRYPTION_KEY=$DB_ENCRYPTION_KEY
@@ -1892,7 +1892,7 @@ services:
roa-backend:
build:
context: .
dockerfile: ./reports-app/backend/Dockerfile
dockerfile: ./backend/Dockerfile
image: roa2web/backend:multi-tenant
container_name: roa-backend
restart: unless-stopped
@@ -1942,7 +1942,7 @@ services:
# Frontend (unchanged)
roa-frontend:
build:
context: ./reports-app/frontend
context: ./src
dockerfile: Dockerfile
image: roa2web/frontend:latest
container_name: roa-frontend
@@ -2443,7 +2443,7 @@ Multi-Tenant (10 tenants):
- **OraclePool:** `shared/database/oracle_pool.py` - Singleton pattern for single-tenant
- **JWT Handler:** `shared/auth/jwt_handler.py` - Token creation/validation (needs tenant_id)
- **Auth Middleware:** `shared/auth/middleware.py` - JWT verification (needs tenant validation)
- **Backend Main:** `reports-app/backend/app/main.py` - Startup logic (needs MultiTenantPoolManager)
- **Backend Main:** `backend/app/main.py` - Startup logic (needs MultiTenantPoolManager)
- **SSH Tunnel Script:** `ssh-tunnel-prod.sh` - Single tunnel script (needs per-tenant manager)
### Inspiration & Patterns