Comprehensive analysis of 101 DDL tables across 11 schemas: - Phase 1-2: Schema validation, 37 gaps cataloged (3 resolved) - Phase 3: Integrity audit (80 FKs, 89 CHECKs, 17 issues: 2 CRIT/5 HIGH) - Phase 4: DDL-Backend mapping (84% interfaces, 75% services, 61% controllers) - Phase 5: Documentation purge catalog (201 files analyzed) - Phase 6: Remediation plan (4 sprints, 204h) Key finding: Backend uses raw SQL + pg Pool (NOT TypeORM). 13 deliverables + updated inventories to v2.0.0. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
413 lines
13 KiB
YAML
413 lines
13 KiB
YAML
# ═══════════════════════════════════════════════════════════════════════════════
|
|
# BACKEND_INVENTORY.yml - Trading Platform
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
version: "1.5.0"
|
|
fecha_actualizacion: "2026-02-04"
|
|
proyecto: "trading-platform"
|
|
ultima_sincronizacion: "2026-02-04T14:00:00Z"
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
# RESUMEN
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
resumen:
|
|
total_modulos: 19 # auth, users, trading, education, investment, notifications, payments, ml, admin, llm, agents, portfolio, shared, currency, risk, proxy, feature-flags, market-data, audit, bots
|
|
total_controllers: 35 # +2 market-data, bots
|
|
total_services: 54 # +2 market-data, bots
|
|
total_repositories: 4
|
|
total_endpoints: 116 # Conteo real post Sprint 3 (~116 implementados)
|
|
ubicacion: "apps/backend/src/"
|
|
framework: "Express.js 5.0.1"
|
|
lenguaje: "TypeScript 5.3.3"
|
|
ultima_sincronizacion: "2026-02-04T14:00:00Z"
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
# MODULOS
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
modulos:
|
|
|
|
auth:
|
|
descripcion: "Autenticacion OAuth, Email, SMS, 2FA"
|
|
controllers: 6 # email-auth, oauth, phone-auth, token, auth, two-factor
|
|
services: 6 # token, email, oauth, phone, twofa, session-cache
|
|
routes: 1
|
|
endpoints: 27 # register, login, verify-email, forgot/reset-password, change-password, phone, oauth, 2fa, sessions
|
|
dtos: 6
|
|
servicios_detalle:
|
|
- token.service.ts
|
|
- email.service.ts
|
|
- oauth.service.ts
|
|
- phone.service.ts
|
|
- twofa.service.ts
|
|
- session-cache.service.ts
|
|
controllers_detalle:
|
|
- auth.controller.ts
|
|
- email-auth.controller.ts
|
|
- oauth.controller.ts
|
|
- phone-auth.controller.ts
|
|
- token.controller.ts
|
|
- two-factor.controller.ts
|
|
|
|
users:
|
|
descripcion: "Gestion de perfiles de usuario (mejorado Sprint 3)"
|
|
controllers: 1
|
|
services: 1
|
|
routes: 1
|
|
endpoints: 16 # +6 endpoints Sprint 3: me, update, avatar, password, delete, public, admin CRUD, preferences, activity
|
|
servicios_detalle:
|
|
- users.service.ts
|
|
controllers_detalle:
|
|
- users.controller.ts
|
|
sprint_3_endpoints:
|
|
- GET /users/me/preferences
|
|
- PUT /users/me/preferences
|
|
- GET /users/me/activity
|
|
- GET /users/me/sessions
|
|
- DELETE /users/me/sessions/:id
|
|
- POST /users/me/export
|
|
|
|
trading:
|
|
descripcion: "Orders, trades, signals, bots, watchlist, alerts"
|
|
controllers: 6 # trading, watchlist, indicators, alerts, export, bots
|
|
services: 11 # binance, cache, indicators, market, paper-trading, watchlist, export, alerts, order, drawing, bots
|
|
routes: 1
|
|
endpoints: 64 # market data (9), indicators (9), paper trading (13), export (4), watchlist (10), alerts (9), bots (11)
|
|
servicios_detalle:
|
|
- binance.service.ts
|
|
- cache.service.ts
|
|
- indicators.service.ts
|
|
- market.service.ts
|
|
- paper-trading.service.ts
|
|
- watchlist.service.ts
|
|
- export.service.ts
|
|
- alerts.service.ts
|
|
- order.service.ts
|
|
- drawing.service.ts
|
|
- bots.service.ts # NUEVO Sprint 3
|
|
controllers_detalle:
|
|
- trading.controller.ts
|
|
- watchlist.controller.ts
|
|
- indicators.controller.ts
|
|
- alerts.controller.ts
|
|
- export.controller.ts
|
|
- bots.controller.ts # NUEVO Sprint 3
|
|
bots_endpoints_sprint_3:
|
|
- GET /trading/bots
|
|
- GET /trading/bots/:id
|
|
- POST /trading/bots
|
|
- PUT /trading/bots/:id
|
|
- DELETE /trading/bots/:id
|
|
- POST /trading/bots/:id/start
|
|
- POST /trading/bots/:id/stop
|
|
- GET /trading/bots/:id/stats
|
|
- GET /trading/bots/:id/trades
|
|
- GET /trading/bots/templates
|
|
- POST /trading/bots/from-template
|
|
|
|
education:
|
|
descripcion: "Cursos, quizzes, gamificacion, videos"
|
|
controllers: 4
|
|
services: 5
|
|
routes: 1
|
|
controllers_detalle:
|
|
- course.controller.ts
|
|
- enrollment.controller.ts
|
|
- quiz.controller.ts
|
|
- video.controller.ts
|
|
servicios_detalle:
|
|
- course.service.ts
|
|
- enrollment.service.ts
|
|
- gamification.service.ts
|
|
- quiz.service.ts
|
|
- video.service.ts
|
|
|
|
investment:
|
|
descripcion: "Productos, cuentas, portafolio, distribuciones"
|
|
controllers: 0
|
|
services: 3
|
|
routes: 1
|
|
jobs: 1
|
|
tests: 1
|
|
servicios_detalle:
|
|
- account.service.ts
|
|
- product.service.ts
|
|
- transaction.service.ts
|
|
jobs_detalle:
|
|
- distribution.job.ts
|
|
tests_detalle:
|
|
- jobs/__tests__/distribution.job.spec.ts
|
|
|
|
notifications:
|
|
descripcion: "Notificaciones multi-canal (email, push, in-app, WebSocket)"
|
|
controllers: 1
|
|
services: 1
|
|
routes: 1
|
|
tests: 1
|
|
servicios_detalle:
|
|
- notification.service.ts
|
|
controllers_detalle:
|
|
- notification.controller.ts
|
|
rutas_detalle:
|
|
- notification.routes.ts
|
|
tests_detalle:
|
|
- services/__tests__/notification.service.spec.ts
|
|
endpoints:
|
|
- GET /notifications
|
|
- GET /notifications/unread-count
|
|
- GET /notifications/preferences
|
|
- PATCH /notifications/preferences
|
|
- POST /notifications/read-all
|
|
- PATCH /notifications/:id/read
|
|
- DELETE /notifications/:id
|
|
- POST /notifications/push-token
|
|
- DELETE /notifications/push-token
|
|
integraciones:
|
|
- Firebase Cloud Messaging (FCM)
|
|
- Web Push
|
|
- Nodemailer
|
|
|
|
payments:
|
|
descripcion: "Stripe, wallets, subscriptions"
|
|
controllers: 0
|
|
services: 3
|
|
routes: 1
|
|
servicios_detalle:
|
|
- stripe.service.ts
|
|
- wallet.service.ts
|
|
- subscription.service.ts
|
|
|
|
ml:
|
|
descripcion: "Predicciones, modelos, backtesting"
|
|
controllers: 0
|
|
services: 6
|
|
routes: 1
|
|
servicios_detalle:
|
|
- prediction.service.ts
|
|
- model.service.ts
|
|
- backtest.service.ts
|
|
- feature.service.ts
|
|
- risk.service.ts
|
|
- ensemble.service.ts
|
|
|
|
admin:
|
|
descripcion: "Stats, modelos ML, agentes"
|
|
controllers: 0
|
|
services: 1
|
|
routes: 1
|
|
|
|
llm:
|
|
descripcion: "LLM agent, estrategias"
|
|
controllers: 0
|
|
services: 1
|
|
routes: 1
|
|
|
|
agents:
|
|
descripcion: "Trading agents orquestacion"
|
|
controllers: 0
|
|
services: 1
|
|
routes: 1
|
|
|
|
portfolio:
|
|
descripcion: "Portfolio management, allocations, goals, rebalancing, performance"
|
|
controllers: 1
|
|
services: 1
|
|
repositories: 4
|
|
routes: 1
|
|
websocket: 1
|
|
endpoints: 17
|
|
servicios_detalle:
|
|
- portfolio.service.ts
|
|
controllers_detalle:
|
|
- portfolio.controller.ts
|
|
repositories_detalle:
|
|
- portfolio.repository.ts
|
|
- allocation.repository.ts
|
|
- goal.repository.ts
|
|
- snapshot.repository.ts
|
|
websocket_detalle:
|
|
- portfolio.websocket.ts
|
|
endpoints_detalle:
|
|
- GET /portfolio
|
|
- POST /portfolio
|
|
- GET /portfolio/:id
|
|
- PUT /portfolio/:id/allocations
|
|
- GET /portfolio/:id/stats
|
|
- GET /portfolio/:id/rebalance
|
|
- POST /portfolio/:id/rebalance
|
|
- GET /portfolio/:id/performance
|
|
- GET /portfolio/:id/performance/stats
|
|
- GET /portfolio/goals
|
|
- POST /portfolio/goals
|
|
- PATCH /portfolio/goals/:id
|
|
- DELETE /portfolio/goals/:id
|
|
|
|
market-data:
|
|
descripcion: "Market data OHLCV, tickers, real-time prices (NUEVO Sprint 3)"
|
|
controllers: 1
|
|
services: 1
|
|
routes: 1
|
|
endpoints: 9 # health, symbols, ohlcv x2, historical, ticker, tickers, price, ticker-info
|
|
servicios_detalle:
|
|
- marketData.service.ts
|
|
controllers_detalle:
|
|
- market-data.controller.ts
|
|
|
|
audit:
|
|
descripcion: "Audit logs, security events, compliance tracking (NUEVO Sprint 3)"
|
|
controllers: 1
|
|
services: 1
|
|
routes: 1
|
|
endpoints: 13 # my-activity, logs, security-events, compliance, stats, log, events
|
|
servicios_detalle:
|
|
- audit.service.ts
|
|
controllers_detalle:
|
|
- audit.controller.ts
|
|
|
|
currency:
|
|
descripcion: "Currency conversion and rates"
|
|
controllers: 1
|
|
services: 1
|
|
routes: 1
|
|
endpoints: 4
|
|
servicios_detalle:
|
|
- currency.service.ts
|
|
controllers_detalle:
|
|
- currency.controller.ts
|
|
|
|
risk:
|
|
descripcion: "Risk assessment and monitoring"
|
|
controllers: 1
|
|
services: 1
|
|
routes: 1
|
|
endpoints: 7
|
|
servicios_detalle:
|
|
- risk.service.ts
|
|
controllers_detalle:
|
|
- risk.controller.ts
|
|
|
|
proxy:
|
|
descripcion: "External API proxy services"
|
|
controllers: 1
|
|
services: 1
|
|
routes: 1
|
|
endpoints: 34
|
|
servicios_detalle:
|
|
- proxy.service.ts
|
|
controllers_detalle:
|
|
- proxy.controller.ts
|
|
|
|
feature-flags:
|
|
descripcion: "Feature flags management"
|
|
controllers: 1
|
|
services: 1
|
|
routes: 1
|
|
endpoints: 12
|
|
servicios_detalle:
|
|
- feature-flags.service.ts
|
|
controllers_detalle:
|
|
- feature-flags.controller.ts
|
|
|
|
shared:
|
|
descripcion: "Servicios compartidos (storage, video processing, etc.)"
|
|
controllers: 0
|
|
services: 2
|
|
routes: 0
|
|
servicios_detalle:
|
|
- storage.service.ts # S3/R2 multipart upload (ST4.3.2)
|
|
- video-processing.service.ts # Video metadata, thumbnails, transcoding MVP (ST4.3.4)
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
# RUTAS API
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
rutas_api:
|
|
base: "/api/v1"
|
|
endpoints:
|
|
- path: "/auth"
|
|
descripcion: "OAuth, Email, SMS, 2FA"
|
|
- path: "/users"
|
|
descripcion: "Perfil, settings"
|
|
- path: "/trading"
|
|
descripcion: "Orders, trades, signals, bots"
|
|
- path: "/education"
|
|
descripcion: "Cursos, quizzes, gamification, videos (multipart upload)"
|
|
- path: "/investment"
|
|
descripcion: "Productos, cuentas, transacciones"
|
|
- path: "/payments"
|
|
descripcion: "Stripe, wallets, subscriptions"
|
|
- path: "/admin"
|
|
descripcion: "Stats, ML models, agents"
|
|
- path: "/ml"
|
|
descripcion: "Predicciones, modelos"
|
|
- path: "/llm"
|
|
descripcion: "Estrategias LLM"
|
|
- path: "/portfolio"
|
|
descripcion: "Portafolio"
|
|
- path: "/agents"
|
|
descripcion: "Trading agents"
|
|
- path: "/notifications"
|
|
descripcion: "Notificaciones multi-canal"
|
|
|
|
health:
|
|
- path: "/health"
|
|
descripcion: "Quick check"
|
|
- path: "/health/full"
|
|
descripcion: "Sistema completo"
|
|
- path: "/health/services"
|
|
descripcion: "Health por servicio"
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
# INFRAESTRUCTURA
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
infraestructura:
|
|
middleware:
|
|
- auth.middleware.ts
|
|
- error-handler.ts
|
|
- not-found.ts
|
|
- rate-limiter.ts
|
|
|
|
websocket:
|
|
- websocket.server.ts
|
|
- trading-stream.service.ts
|
|
- portfolio.websocket.ts # Real-time portfolio updates (2026-01-25)
|
|
|
|
jobs:
|
|
- distribution.job.ts # Distribución diaria de rendimientos (00:00 UTC)
|
|
|
|
clients:
|
|
- firebase.client.ts # FCM/Web Push integration (2026-01-25)
|
|
|
|
config:
|
|
- swagger.config.ts
|
|
- index.ts
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
# INTEGRACIONES
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
integraciones:
|
|
base_datos:
|
|
- PostgreSQL
|
|
- Redis
|
|
storage:
|
|
- S3 / R2 (multipart upload)
|
|
pagos:
|
|
- Stripe
|
|
oauth:
|
|
- Google
|
|
- Facebook
|
|
- GitHub
|
|
- Apple
|
|
comunicacion:
|
|
- Twilio
|
|
- Nodemailer
|
|
llm:
|
|
- OpenAI
|
|
- Anthropic
|
|
trading:
|
|
- Binance
|
|
- MetaTrader
|