From 07dc847096eae3e869b26b2d07348b119144db71 Mon Sep 17 00:00:00 2001 From: Adrian Flores Cortes Date: Sun, 25 Jan 2026 02:05:14 -0600 Subject: [PATCH] [TASK-2026-01-25-FRONTEND-ANALYSIS] docs: Complete pending deliverables - Update FRONTEND_INVENTORY.yml with componentes_modulos section (32 components) - Add FILE-GENERATION-SPEC.md for PDF/Excel/multimedia handling Co-Authored-By: Claude Opus 4.5 --- .../analisis/FILE-GENERATION-SPEC.md | 206 ++++++++++++++++++ .../inventarios/FRONTEND_INVENTORY.yml | 62 +++++- 2 files changed, 266 insertions(+), 2 deletions(-) create mode 100644 docs/90-transversal/analisis/FILE-GENERATION-SPEC.md diff --git a/docs/90-transversal/analisis/FILE-GENERATION-SPEC.md b/docs/90-transversal/analisis/FILE-GENERATION-SPEC.md new file mode 100644 index 0000000..b8b2d77 --- /dev/null +++ b/docs/90-transversal/analisis/FILE-GENERATION-SPEC.md @@ -0,0 +1,206 @@ +# Especificacion de Generacion de Archivos + +**Proyecto:** trading-platform +**Fecha:** 2026-01-25 +**Version:** 1.0.0 + +--- + +## 1. Generacion de PDF + +### 1.1 Capacidades Actuales + +| Modulo | Tipo de PDF | Estado | Libreria | +|--------|-------------|--------|----------| +| Education | Certificados | ✅ Implementado | PDFKit | +| Payments | Facturas | ✅ Implementado | Stripe PDF | +| Portfolio | Reportes | ⚠️ Diseño | TBD | +| Investment | Estados de cuenta | ⚠️ Diseño | TBD | + +### 1.2 Especificacion Tecnica - Reportes Portfolio + +```typescript +interface PortfolioReportConfig { + userId: string; + dateRange: { + start: Date; + end: Date; + }; + sections: { + summary: boolean; + positions: boolean; + performance: boolean; + riskMetrics: boolean; + transactions: boolean; + }; + format: 'pdf' | 'xlsx'; + delivery: 'download' | 'email'; +} +``` + +### 1.3 Librerias Recomendadas + +| Libreria | Uso | Pros | Contras | +|----------|-----|------|---------| +| PDFKit | Server-side PDF | Ligero, flexible | Manual layout | +| Puppeteer | HTML to PDF | Diseño facil | Pesado | +| jsPDF | Client-side | Sin servidor | Limitado | +| ExcelJS | XLSX generation | Completo | Solo Excel | + +--- + +## 2. Generacion de Excel/CSV + +### 2.1 Capacidades Actuales + +| Modulo | Tipo | Estado | Endpoint | +|--------|------|--------|----------| +| Trading | Trade history CSV | ✅ | /api/v1/trading/export | +| Education | Progress report | ⚠️ | Pendiente | +| Portfolio | Positions XLSX | ⚠️ | Diseño | +| Investment | Transactions CSV | ⚠️ | Diseño | + +### 2.2 Formato de Exportacion + +```typescript +interface ExportConfig { + format: 'csv' | 'xlsx'; + columns: string[]; + filters?: Record; + dateRange?: { start: Date; end: Date }; + includeHeaders: boolean; + filename: string; +} +``` + +--- + +## 3. Manejo de Multimedia + +### 3.1 Imagenes + +| Tipo | Uso | Almacenamiento | Max Size | +|------|-----|----------------|----------| +| Avatar | Perfil usuario | S3/Local | 2MB | +| Course thumbnails | Educacion | S3/Local | 5MB | +| Chart screenshots | Trading | Temporal | 10MB | + +### 3.2 Videos + +| Tipo | Uso | Almacenamiento | Streaming | +|------|-----|----------------|-----------| +| Lecciones | Educacion | S3/Vimeo | HLS | +| Tutoriales | Onboarding | YouTube embed | iframe | + +### 3.3 Audio + +| Tipo | Uso | Estado | +|------|-----|--------| +| Alertas | Trading signals | ✅ Web Audio API | +| Notificaciones | Push alerts | ✅ Browser native | + +--- + +## 4. Endpoints de Generacion + +### 4.1 Existentes + +```yaml +POST /api/v1/trading/export: + description: Export trade history + params: + format: csv|xlsx + dateRange: { start, end } + response: File download + +POST /api/v1/education/certificate: + description: Generate course certificate + params: + courseId: string + userId: string + response: PDF download +``` + +### 4.2 Propuestos + +```yaml +POST /api/v1/portfolio/reports/pdf: + description: Generate portfolio report + params: + config: PortfolioReportConfig + response: PDF download | email confirmation + +POST /api/v1/portfolio/export: + description: Export positions/history + params: + format: csv|xlsx + type: positions|history|transactions + response: File download + +POST /api/v1/investment/statement: + description: Generate account statement + params: + accountId: string + period: monthly|quarterly|annual + response: PDF download +``` + +--- + +## 5. Implementacion Frontend + +### 5.1 Componentes de Exportacion + +```typescript +// ExportButton.tsx +interface ExportButtonProps { + endpoint: string; + format: 'pdf' | 'csv' | 'xlsx'; + params: Record; + filename: string; + label?: string; +} + +// ReportGenerator.tsx +interface ReportGeneratorProps { + type: 'portfolio' | 'investment' | 'trading'; + onGenerate: (config: ReportConfig) => Promise; + onDownload: (url: string) => void; +} +``` + +### 5.2 Flujo de Usuario + +``` +1. Usuario selecciona tipo de reporte +2. Configura parametros (fecha, secciones) +3. Click "Generar" +4. Backend procesa (async si es grande) +5. Notificacion cuando listo +6. Descarga o envio por email +``` + +--- + +## 6. Consideraciones de Performance + +| Operacion | Threshold | Estrategia | +|-----------|-----------|------------| +| PDF < 10 paginas | Sync | Respuesta directa | +| PDF > 10 paginas | Async | Job queue + notificacion | +| Excel < 10k rows | Sync | Respuesta directa | +| Excel > 10k rows | Async | Job queue + notificacion | +| Bulk export | Async | Background job | + +--- + +## 7. Seguridad + +- Todos los endpoints requieren autenticacion +- Rate limiting: 10 exports/hora por usuario +- Archivos temporales eliminados despues de 1 hora +- No incluir datos sensibles en exports sin consentimiento + +--- + +*Generado: 2026-01-25 | Sistema: SIMCO v4.0.0* diff --git a/orchestration/inventarios/FRONTEND_INVENTORY.yml b/orchestration/inventarios/FRONTEND_INVENTORY.yml index f99f479..fce875d 100644 --- a/orchestration/inventarios/FRONTEND_INVENTORY.yml +++ b/orchestration/inventarios/FRONTEND_INVENTORY.yml @@ -3,7 +3,7 @@ # ═══════════════════════════════════════════════════════════════════════════════ version: "1.0.0" -fecha_actualizacion: "2026-01-24" +fecha_actualizacion: "2026-01-25" proyecto: "trading-platform" # ═══════════════════════════════════════════════════════════════════════════════ @@ -12,7 +12,7 @@ proyecto: "trading-platform" resumen: total_paginas: 27 - total_componentes: 16 + total_componentes: 48 total_stores: 4 total_services: 9 total_hooks: 2 @@ -20,6 +20,7 @@ resumen: framework: "React 18.2.0" build_tool: "Vite 6.2.0" lenguaje: "TypeScript 5.3.3" + fecha_actualizacion: "2026-01-25" # ═══════════════════════════════════════════════════════════════════════════════ # PAGINAS POR MODULO @@ -151,6 +152,63 @@ componentes: - MainLayout.tsx - AuthLayout.tsx +# ═══════════════════════════════════════════════════════════════════════════════ +# COMPONENTES POR MODULO (Detalle adicional) +# ═══════════════════════════════════════════════════════════════════════════════ + +componentes_modulos: + trading: + cantidad: 12 + lista: + - TradingChart.tsx + - OrderBook.tsx + - OrderForm.tsx + - PositionsPanel.tsx + - TradeHistory.tsx + - WatchlistPanel.tsx + - SymbolSearch.tsx + - TimeframeSelector.tsx + - IndicatorPanel.tsx + - AlertsPanel.tsx + - MarketDepth.tsx + - QuickTrade.tsx + + ml: + cantidad: 7 + lista: + - AMDPhaseIndicator.tsx + - PredictionCard.tsx + - SignalsTimeline.tsx + - ConfidenceMeter.tsx + - ModelSelector.tsx + - EnsemblePanel.tsx + - ICTAnalysisPanel.tsx + + auth: + cantidad: 4 + lista: + - SocialLoginButtons.tsx + - PhoneLoginForm.tsx + - TwoFactorForm.tsx + - PasswordStrengthMeter.tsx + + assistant: + cantidad: 4 + lista: + - ChatWindow.tsx + - ChatMessage.tsx + - ChatInput.tsx + - SignalCard.tsx + + portfolio: + cantidad: 5 + lista: + - PortfolioSummaryCard.tsx + - PositionsTable.tsx + - PerformanceChart.tsx + - RiskMetricsPanel.tsx + - RebalanceModal.tsx + # ═══════════════════════════════════════════════════════════════════════════════ # STATE MANAGEMENT # ═══════════════════════════════════════════════════════════════════════════════