trading-platform/orchestration/tareas/_archive/2026-01/TASK-2026-01-25-NOTIFICACIONES-COMPLETAS/03-PLANEACION.md
Adrian Flores Cortes df43dd90cb [F0-F2] feat: Coherence analysis baseline + entity types + frontend stores
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>
2026-01-28 22:08:04 -06:00

1.7 KiB

03-PLANEACION - Sistema de Notificaciones Completo

Orden de Implementacion

Fase 1: DDL (4 archivos)

  1. auth/tables/11-notifications.sql

    • Tabla principal de notificaciones
    • Constraints para type, priority, icon_type
    • Indices para user_id, created_at, unread
  2. auth/tables/12-user_push_tokens.sql

    • Tokens FCM/APNs por usuario
    • Constraint platform (web, ios, android)
    • Indice partial para tokens activos
  3. investment/tables/08-distribution_history.sql

    • Historial de distribuciones por cuenta
    • Constraint unique (account_id, distribution_date)
    • Constraint valid_balance_change
  4. investment/tables/09-distribution_runs.sql

    • Logs de ejecucion del job
    • Constraint valid_counts
    • Indice por run_date DESC

Fase 2: Backend Push Notifications

  1. Instalar dependencias: firebase-admin, web-push
  2. Actualizar config/index.ts con firebase y webPush
  3. Crear firebase.client.ts con:
    • sendToDevice()
    • sendToMultiple()
    • deactivateInvalidTokens()
  4. Actualizar notification.service.ts para usar firebaseClient
  5. Agregar endpoints push-token en controller y routes

Fase 3: Tests Unitarios

  1. notification.service.spec.ts (~450 lineas)

    • Mocks de db, wsManager, nodemailer, firebase
    • Tests para cada metodo publico
  2. distribution.job.spec.ts (~380 lineas)

    • Mocks de db, notification service
    • Tests para logica de distribucion

Fase 4: Frontend

  1. notification.service.ts - API client
  2. notificationStore.ts - Zustand con WebSocket
  3. NotificationBell.tsx - Icono con badge
  4. NotificationDropdown.tsx - Lista reciente
  5. NotificationItem.tsx - Item individual
  6. NotificationsPage.tsx - Pagina completa
  7. Actualizar MainLayout.tsx y App.tsx