FASE 0 - Preparación y Purga: - Archived 21 completed tasks to _archive/2026-01/ - Marked 4 docs as DEPRECATED - Created 3 baseline coherence reports FASE 1 - DDL-Backend Coherence: - audit.types.ts: +4 types (SystemEvent, TradingAudit, ApiRequestLog, DataAccessLog) - investment.types.ts: +4 types (RiskQuestionnaire, WithdrawalRequest, DailyPerformance, DistributionHistory) - entity.types.ts: +5 types (Symbol, TradingBot, TradingSignal, TradingMetrics, PaperBalance) FASE 2 - Backend-Frontend Coherence: - investmentStore.ts: New Zustand store with 20+ actions - mlStore.ts: New Zustand store with signal caching - alerts.service.ts: New service with 15 functions FASE 3 - Documentation: - OQI-009: Updated to 100% coverage, added ET-MKT-004-productos.md - OQI-010: Created full structure (STATUS.md, ROADMAP-MT4.md, ET-MT4-001-gateway.md) Coherence Baseline Established: - DDL-Backend: 31% (target 95%) - Backend-Frontend: 72% (target 85%) - Global: 39.6% (target 90%) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
201 lines
5.4 KiB
Markdown
201 lines
5.4 KiB
Markdown
# AUDIT-BACKEND-FRONTEND.md
|
|
## Auditoría de Coherencia Backend ↔ Frontend
|
|
|
|
**Fecha:** 2026-01-28
|
|
**Proyecto:** trading-platform
|
|
**Auditor:** Claude Code (Opus 4.5)
|
|
**Fase:** F0.3.2
|
|
|
|
---
|
|
|
|
## RESUMEN EJECUTIVO
|
|
|
|
| Métrica | Valor | Target | Gap |
|
|
|---------|-------|--------|-----|
|
|
| **Coherencia Backend-Frontend** | 72% | 85% | -13pp |
|
|
| **Endpoints totales** | 208+ | - | - |
|
|
| **Endpoints con consumidor** | 147 | 208 | 61 faltantes |
|
|
| **Services frontend** | 15 | 26 | 11 faltantes |
|
|
| **Stores Zustand** | 8 | 17 | 9 faltantes |
|
|
|
|
---
|
|
|
|
## MAPEO DE MÓDULOS
|
|
|
|
| Módulo | Endpoints | Service FE | Store | Cobertura | Estado |
|
|
|--------|-----------|------------|-------|-----------|--------|
|
|
| **auth** | 27 | ✅ | ✅ (implícito) | 100% | COMPLETO |
|
|
| **users** | 6 | ✅ | ✅ (implícito) | 100% | COMPLETO |
|
|
| **trading** | 47 | ✅ | ✅ tradingStore | 95% | INCOMPLETO |
|
|
| **portfolio** | 12 | ✅ | ✅ portfolioStore | 100% | COMPLETO |
|
|
| **investment** | 13 | ✅ | ❌ NO | 50% | INCOMPLETO |
|
|
| **education** | 45 | ✅ | ✅ educationStore | 98% | INCOMPLETO |
|
|
| **payments** | 20 | ✅ | ✅ paymentStore | 95% | INCOMPLETO |
|
|
| **agents** | 16 | ✅ | ✅ agentsStore | 85% | INCOMPLETO |
|
|
| **notifications** | 9 | ✅ | ✅ notificationStore | 100% | COMPLETO |
|
|
| **market-data** | 4 | ⚠️ PARCIAL | ❌ NO | 50% | INCOMPLETO |
|
|
| **ml** | 19 | ⚠️ limitado | ❌ NO | 60% | INCOMPLETO |
|
|
| **llm** | 6 | ⚠️ parcial | ❌ NO | 50% | INCOMPLETO |
|
|
| **currency** | 4 | ❌ NO | ❌ NO | 0% | ÓRFANO |
|
|
| **audit** | 8 | ❌ NO | ❌ NO | 0% | ÓRFANO |
|
|
| **admin** | 8 | ✅ | ❌ NO | 50% | INCOMPLETO |
|
|
| **risk** | 7 | ❌ NO | ❌ NO | 0% | ÓRFANO |
|
|
| **proxy** | 20 | ⚠️ indirecto | ❌ NO | 30% | INCOMPLETO |
|
|
|
|
---
|
|
|
|
## GAPS CRÍTICOS
|
|
|
|
### 1. Endpoints Sin Consumo Frontend (HIGH PRIORITY)
|
|
|
|
**GAP-BF-001: Trading Alerts** (6 endpoints)
|
|
- Rutas: POST/GET/PATCH/DELETE `/api/v1/trading/alerts*`
|
|
- Estado: Backend ✅ | Frontend ❌
|
|
- Impacto: CRÍTICO - Feature de alertas NO funcional
|
|
- Acción: Crear `alertsService.ts`
|
|
|
|
**GAP-BF-002: Investment Withdrawals** (1 endpoint)
|
|
- Ruta: GET `/api/v1/investment/withdrawals`
|
|
- Estado: Backend ✅ | Frontend ❌
|
|
- Impacto: ALTO - Historial NO visible
|
|
- Acción: Agregar a `investment.service.ts`
|
|
|
|
**GAP-BF-003: Currency Module** (4 endpoints)
|
|
- Rutas: GET `/api/v1/currency/rates*`
|
|
- Estado: Backend ✅ | Frontend ❌
|
|
- Impacto: MEDIO - Conversión NO integrada
|
|
- Acción: Crear `currencyService.ts`
|
|
|
|
**GAP-BF-004: Risk Module** (7 endpoints)
|
|
- Rutas: GET/POST `/api/v1/risk/*`
|
|
- Estado: Backend ✅ | Frontend ❌
|
|
- Impacto: ALTO - Cuestionario NO visible
|
|
- Acción: Crear `riskAssessment.service.ts`
|
|
|
|
---
|
|
|
|
### 2. Stores Faltantes
|
|
|
|
| Store | Módulo | Prioridad | Esfuerzo |
|
|
|-------|--------|-----------|----------|
|
|
| **investmentStore** | investment | P0 | 4h |
|
|
| **mlStore** | ml | P1 | 5h |
|
|
| **llmStore** | llm | P1 | 5h |
|
|
| **currencyStore** | currency | P2 | 2h |
|
|
| **riskStore** | risk | P1 | 3h |
|
|
| **adminStore** | admin | P2 | 3h |
|
|
| **marketDataStore** | market-data | P2 | 4h |
|
|
|
|
---
|
|
|
|
## ANÁLISIS POR EPIC
|
|
|
|
### OQI-001 (fundamentos-auth) - 85% ✅
|
|
- Gaps: 2FA flow UI incompleto
|
|
- Acción: Completar flujo verificación
|
|
|
|
### OQI-002 (educativo) - 55% ⚠️
|
|
- Gaps: Quiz history, video processing status
|
|
- Acción: Refactorizar educationStore
|
|
|
|
### OQI-003 (trading-charts) - 60% ⚠️
|
|
- Gaps: Price alerts (SIN servicio)
|
|
- Acción: Crear alertsService URGENTE
|
|
|
|
### OQI-004 (cuentas-inversion) - 55% ⚠️
|
|
- Gaps: investmentStore NO EXISTE
|
|
- Acción: Crear store + expandir service
|
|
|
|
### OQI-005 (pagos-stripe) - 65% ⚠️
|
|
- Gaps: Refund history
|
|
- Acción: Agregar a paymentStore
|
|
|
|
### OQI-006 (senales-ml) - 75% ⚠️
|
|
- Gaps: Signal caching, mlStore
|
|
- Acción: Crear mlStore
|
|
|
|
### OQI-007 (llm-strategy-agent) - 45% ⚠️
|
|
- Gaps: Session management, llmStore
|
|
- Acción: Crear llmStore
|
|
|
|
### OQI-008 (portfolio-manager) - 45% ✅
|
|
- Estado: Bueno, mejoras menores
|
|
|
|
---
|
|
|
|
## BAD PRACTICES DETECTADAS
|
|
|
|
**Resultado: ✅ CERO HALLAZGOS CRÍTICOS**
|
|
|
|
- ✅ Cero llamadas directas axios/fetch en componentes
|
|
- ✅ Todos usan `apiClient` centralizado
|
|
- ✅ Token auto-refresh implementado
|
|
|
|
**FORTALEZA:** Arquitectura de servicios bien estructurada.
|
|
|
|
---
|
|
|
|
## RECOMENDACIONES PRIORIZADAS
|
|
|
|
### FASE 1 - CRÍTICA (Semana 1)
|
|
|
|
**P1.1** Crear `alertsService.ts` + integrar en tradingStore
|
|
- Endpoints: 6
|
|
- Esfuerzo: 3-4 horas
|
|
|
|
**P1.2** Expandir `investment.service.ts`
|
|
- Métodos: getWithdrawals, closeAccount, getDistributions
|
|
- Esfuerzo: 2 horas
|
|
|
|
**P1.3** Crear `investmentStore.ts`
|
|
- Esfuerzo: 4 horas
|
|
|
|
### FASE 2 - ALTA (Semana 2)
|
|
|
|
**P2.1** Crear `mlStore.ts`
|
|
- Esfuerzo: 5 horas
|
|
|
|
**P2.2** Refactorizar `mlService.ts` (type safety)
|
|
- Esfuerzo: 3 horas
|
|
|
|
**P2.3** Crear `riskAssessmentService.ts`
|
|
- Esfuerzo: 4 horas
|
|
|
|
### FASE 3 - MEDIA (Semana 3)
|
|
|
|
**P3.1** Crear `currencyService.ts` (si necesario)
|
|
**P3.2** Crear `llmStore.ts`
|
|
**P3.3** Documentar market-data vs trading endpoints
|
|
|
|
---
|
|
|
|
## CHECKLIST DE COHERENCIA
|
|
|
|
```
|
|
Para cada nuevo módulo/endpoint:
|
|
|
|
□ Backend:
|
|
□ Ruta en [module].routes.ts
|
|
□ Controller implementado
|
|
□ Service implementado
|
|
□ Tests
|
|
|
|
□ Frontend Service:
|
|
□ Servicio en services/[module].service.ts
|
|
□ Tipos importados
|
|
□ Error handling
|
|
|
|
□ Frontend Store:
|
|
□ Store Zustand si hay estado global
|
|
□ Actions CRUD
|
|
□ Tests
|
|
|
|
□ Coherencia:
|
|
□ Validar con este audit
|
|
□ Cobertura > 90%
|
|
```
|
|
|
|
---
|
|
|
|
*Generado: 2026-01-28 | Sistema SIMCO v4.0.0*
|