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>
1.7 KiB
1.7 KiB
03-PLANEACION - Sistema de Notificaciones Completo
Orden de Implementacion
Fase 1: DDL (4 archivos)
-
auth/tables/11-notifications.sql- Tabla principal de notificaciones
- Constraints para type, priority, icon_type
- Indices para user_id, created_at, unread
-
auth/tables/12-user_push_tokens.sql- Tokens FCM/APNs por usuario
- Constraint platform (web, ios, android)
- Indice partial para tokens activos
-
investment/tables/08-distribution_history.sql- Historial de distribuciones por cuenta
- Constraint unique (account_id, distribution_date)
- Constraint valid_balance_change
-
investment/tables/09-distribution_runs.sql- Logs de ejecucion del job
- Constraint valid_counts
- Indice por run_date DESC
Fase 2: Backend Push Notifications
- Instalar dependencias:
firebase-admin,web-push - Actualizar config/index.ts con firebase y webPush
- Crear firebase.client.ts con:
- sendToDevice()
- sendToMultiple()
- deactivateInvalidTokens()
- Actualizar notification.service.ts para usar firebaseClient
- Agregar endpoints push-token en controller y routes
Fase 3: Tests Unitarios
-
notification.service.spec.ts (~450 lineas)
- Mocks de db, wsManager, nodemailer, firebase
- Tests para cada metodo publico
-
distribution.job.spec.ts (~380 lineas)
- Mocks de db, notification service
- Tests para logica de distribucion
Fase 4: Frontend
- notification.service.ts - API client
- notificationStore.ts - Zustand con WebSocket
- NotificationBell.tsx - Icono con badge
- NotificationDropdown.tsx - Lista reciente
- NotificationItem.tsx - Item individual
- NotificationsPage.tsx - Pagina completa
- Actualizar MainLayout.tsx y App.tsx