- Updated docs and inventory files - Added new architecture docs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
545 lines
17 KiB
YAML
545 lines
17 KiB
YAML
# BACKEND_INVENTORY.yml - ERP Transportistas
|
|
# Sistema SIMCO v4.0.0
|
|
# CORREGIDO: 2026-01-27 (Auditoria Fase 0)
|
|
# SINCRONIZADO: 2026-01-27 (TASK-007.1)
|
|
|
|
version: "2.2.0"
|
|
created: "2026-01-25"
|
|
updated: "2026-01-28"
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
# SINCRONIZACION
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
sincronizacion:
|
|
ssot: "docs/_definitions/SERVICES-CATALOG.md"
|
|
ultima_sync: "2026-01-27"
|
|
sync_by: "TASK-007.1"
|
|
nota: "Este inventario referencia al SERVICES-CATALOG como fuente canonica"
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
# RESUMEN EJECUTIVO
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
summary:
|
|
framework: NestJS
|
|
language: TypeScript
|
|
total_entities: 166
|
|
entities_heredadas: 109
|
|
entities_propias: 57
|
|
entities_gps: 5
|
|
entities_dispatch: 7
|
|
entities_offline: 1
|
|
entities_whatsapp: 0
|
|
hereda_de: erp-core
|
|
status: "60% implementado (GPS + Dispatch + Offline + WhatsApp completos)"
|
|
|
|
# NOTA IMPORTANTE:
|
|
# El 15% refleja que hay entities pero la mayoria NO tiene:
|
|
# - Services completos
|
|
# - DTOs
|
|
# - Tests
|
|
# - Validaciones de negocio
|
|
# El 40% anterior era INCORRECTO
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
# MODULOS HEREDADOS DE ERP-CORE (109 entities)
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
modules_heredados:
|
|
|
|
- name: auth
|
|
entities: 20
|
|
status: heredado_completo
|
|
descripcion: "Autenticacion, JWT, OAuth, 2FA, sessions"
|
|
entidades:
|
|
- user.entity.ts
|
|
- role.entity.ts
|
|
- permission.entity.ts
|
|
- session.entity.ts
|
|
- tenant.entity.ts
|
|
- company.entity.ts
|
|
- group.entity.ts
|
|
- api-key.entity.ts
|
|
- password-reset.entity.ts
|
|
- oauth-provider.entity.ts
|
|
- oauth-state.entity.ts
|
|
- oauth-user-link.entity.ts
|
|
- trusted-device.entity.ts
|
|
- verification-code.entity.ts
|
|
- mfa-audit-log.entity.ts
|
|
- device.entity.ts
|
|
- user-profile.entity.ts
|
|
- user-profile-assignment.entity.ts
|
|
- profile-tool.entity.ts
|
|
- profile-module.entity.ts
|
|
controllers: 2
|
|
services: heredados
|
|
|
|
- name: ai
|
|
entities: 7
|
|
status: heredado_completo
|
|
descripcion: "Integracion IA/LLM"
|
|
entidades:
|
|
- completion.entity.ts
|
|
- conversation.entity.ts
|
|
- embedding.entity.ts
|
|
- knowledge-base.entity.ts
|
|
- model.entity.ts
|
|
- prompt.entity.ts
|
|
- usage.entity.ts
|
|
controllers: 1
|
|
services: heredados
|
|
|
|
- name: audit
|
|
entities: 7
|
|
status: heredado_completo
|
|
descripcion: "Auditoria y logs"
|
|
entidades:
|
|
- audit-log.entity.ts
|
|
- config-change.entity.ts
|
|
- data-export.entity.ts
|
|
- entity-change.entity.ts
|
|
- login-history.entity.ts
|
|
- permission-change.entity.ts
|
|
- sensitive-data-access.entity.ts
|
|
controllers: 1
|
|
services: heredados
|
|
|
|
- name: billing-usage
|
|
entities: 13
|
|
status: heredado_completo
|
|
descripcion: "Facturacion SaaS y planes"
|
|
controllers: 4
|
|
services: heredados
|
|
|
|
- name: branches
|
|
entities: 5
|
|
status: heredado_completo
|
|
descripcion: "Sucursales"
|
|
controllers: 1
|
|
services: heredados
|
|
|
|
- name: core
|
|
entities: 10
|
|
status: heredado_base
|
|
descripcion: "Modulo core compartido"
|
|
controllers: 1
|
|
services: heredados
|
|
|
|
- name: financial
|
|
entities: 15
|
|
status: heredado_completo
|
|
descripcion: "Contabilidad base"
|
|
controllers: 1
|
|
services: heredados
|
|
|
|
- name: inventory
|
|
entities: 15
|
|
status: heredado_completo
|
|
descripcion: "Inventario base (refacciones)"
|
|
controllers: 3
|
|
services: heredados
|
|
|
|
- name: mcp
|
|
entities: 2
|
|
status: heredado_completo
|
|
descripcion: "MCP Server"
|
|
controllers: 1
|
|
services: heredados
|
|
|
|
- name: notifications
|
|
entities: 6
|
|
status: heredado_completo
|
|
descripcion: "Notificaciones multicanal"
|
|
controllers: 1
|
|
services: heredados
|
|
|
|
- name: partners
|
|
entities: 6
|
|
status: heredado_extendido
|
|
descripcion: "Clientes/Proveedores/Carriers"
|
|
controllers: 3
|
|
services: heredados
|
|
notas: "Extendido para shippers y carriers"
|
|
|
|
- name: payment-terminals
|
|
entities: 3
|
|
status: heredado_completo
|
|
descripcion: "Terminales de pago"
|
|
controllers: 7
|
|
services: heredados
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
# MODULOS PROPIOS DE TRANSPORTE (44 entities)
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
modules_propios:
|
|
|
|
- name: ordenes-transporte
|
|
entities: 5
|
|
status: entity_only
|
|
descripcion: "Ordenes de transporte y cotizaciones"
|
|
modulo_simco: MAI-003
|
|
entidades:
|
|
- quotation.entity.ts
|
|
- quotation-item.entity.ts
|
|
- sales-order.entity.ts
|
|
- sales-order-item.entity.ts
|
|
- (1 adicional)
|
|
controllers: 2
|
|
services: pendiente
|
|
dtos: pendiente
|
|
notas: |
|
|
Entities creadas pero son GENERICAS de sales.
|
|
Falta: OrdenTransporte, Embarque, Parada, RestriccionOT
|
|
como entities ESPECIALIZADAS del giro transporte.
|
|
|
|
- name: gestion-flota
|
|
entities: 9
|
|
status: entity_only
|
|
descripcion: "Unidades, operadores, productos"
|
|
modulo_simco: MAI-011
|
|
entidades:
|
|
- product.entity.ts
|
|
- product-category.entity.ts
|
|
- product-variant.entity.ts
|
|
- product-attribute.entity.ts
|
|
- product-attribute-value.entity.ts
|
|
- product-price.entity.ts
|
|
- product-supplier.entity.ts
|
|
- (2 adicionales)
|
|
controllers: 3
|
|
services: pendiente
|
|
notas: |
|
|
Entities son GENERICAS de products.
|
|
Falta: Unidad, Remolque, Operador, LicenciaOperador,
|
|
DocumentoUnidad, DisponibilidadOperador como
|
|
entities ESPECIALIZADAS del giro transporte.
|
|
|
|
- name: gps
|
|
entities: 5
|
|
status: implementado
|
|
descripcion: "Módulo GPS completo - Sprint S1 TASK-007"
|
|
modulo_simco: MAI-006
|
|
fuente: "erp-mecanicas-diesel/backend/src/modules/gps (MMD-014)"
|
|
entidades:
|
|
- dispositivo-gps.entity.ts
|
|
- posicion-gps.entity.ts
|
|
- geocerca.entity.ts
|
|
- evento-geocerca.entity.ts
|
|
- segmento-ruta.entity.ts
|
|
services:
|
|
- dispositivo-gps.service.ts
|
|
- posicion-gps.service.ts
|
|
- geocerca.service.ts
|
|
- segmento-ruta.service.ts
|
|
controllers:
|
|
- dispositivo-gps.controller.ts
|
|
- posicion-gps.controller.ts
|
|
- geocerca.controller.ts
|
|
- segmento-ruta.controller.ts
|
|
endpoints: 45
|
|
ddl: "03a-gps-devices-ddl.sql"
|
|
creado: "2026-01-28"
|
|
notas: |
|
|
Sprint S1 completado. Adaptado de erp-mecanicas-diesel.
|
|
Incluye: multi-provider GPS (Traccar, Wialon, Samsara, Geotab),
|
|
geocercas con polígonos PostGIS, eventos de entrada/salida,
|
|
segmentos de ruta con distancia Haversine.
|
|
|
|
- name: dispatch
|
|
entities: 7
|
|
status: implementado
|
|
descripcion: "Centro de Despacho - Sprint S2 TASK-007"
|
|
modulo_simco: MAI-005
|
|
fuente: "erp-mecanicas-diesel/backend/src/modules/dispatch (MMD-011)"
|
|
entidades:
|
|
- dispatch-board.entity.ts
|
|
- estado-unidad.entity.ts
|
|
- operador-certificacion.entity.ts
|
|
- turno-operador.entity.ts
|
|
- regla-despacho.entity.ts
|
|
- regla-escalamiento.entity.ts
|
|
- log-despacho.entity.ts
|
|
services:
|
|
- dispatch.service.ts
|
|
- certificacion.service.ts
|
|
- turno.service.ts
|
|
- rule.service.ts
|
|
controllers:
|
|
- dispatch.controller.ts
|
|
- certificacion.controller.ts
|
|
- turno.controller.ts
|
|
- rule.controller.ts
|
|
endpoints: 52
|
|
ddl: "09-dispatch-schema-ddl.sql"
|
|
creado: "2026-01-28"
|
|
notas: |
|
|
Sprint S2 completado. Adaptado de erp-mecanicas-diesel.
|
|
Schema: dispatch → despacho.
|
|
Renombres: incident → viaje, technician → operador.
|
|
Incluye: algoritmo de sugerencia Haversine, certificaciones
|
|
operador (LIC_FEDERAL, CERT_MP), turnos, reglas de despacho
|
|
y escalamiento, log de auditoría.
|
|
|
|
- name: offline
|
|
entities: 1
|
|
status: implementado
|
|
descripcion: "Sincronización Offline - Sprint S4 TASK-007"
|
|
modulo_simco: MAI-006
|
|
entidades:
|
|
- offline-queue.entity.ts
|
|
services:
|
|
- sync.service.ts
|
|
controllers:
|
|
- sync.controller.ts
|
|
endpoints: 8
|
|
creado: "2026-01-28"
|
|
notas: |
|
|
Sprint S4 completado.
|
|
Incluye: cola de prioridad, resolución de conflictos (CLIENT_WINS,
|
|
SERVER_WINS, MERGE), tipos de operación (GPS, POD, Viajes),
|
|
reintentos automáticos, estadísticas de sincronización.
|
|
|
|
- name: whatsapp
|
|
entities: 0
|
|
status: implementado
|
|
descripcion: "Notificaciones WhatsApp - Sprint S5 TASK-007"
|
|
modulo_simco: MAI-006
|
|
templates:
|
|
- transport-templates.ts (9 templates)
|
|
services:
|
|
- whatsapp-notification.service.ts
|
|
controllers:
|
|
- whatsapp.controller.ts
|
|
endpoints: 11
|
|
creado: "2026-01-28"
|
|
notas: |
|
|
Sprint S5 completado.
|
|
Templates: viaje_asignado, viaje_confirmado, eta_actualizado,
|
|
viaje_completado, alerta_retraso, asignacion_carrier,
|
|
recordatorio_mantenimiento, pod_disponible, factura_lista.
|
|
Incluye: modo simulación, validación telefónos MX, rate limiting batch.
|
|
|
|
- name: tracking
|
|
entities: 2
|
|
status: entity_only
|
|
descripcion: "Tracking eventos y alertas (complementa GPS)"
|
|
modulo_simco: MAI-006
|
|
controllers: 1
|
|
services: pendiente
|
|
notas: |
|
|
Entities basicas existentes.
|
|
El modulo GPS cubre la mayoria de funcionalidad de tracking.
|
|
|
|
- name: viajes
|
|
entities: 4
|
|
status: entity_only
|
|
descripcion: "Viajes y timesheets"
|
|
modulo_simco: MAI-003/MAI-004
|
|
entidades:
|
|
- timesheet.entity.ts
|
|
- (3 adicionales)
|
|
controllers: 2
|
|
services: pendiente
|
|
notas: |
|
|
Entities genericas de projects.
|
|
Falta: Viaje, Ruta, ParadaViaje, ChecklistPreViaje,
|
|
SelloViaje, EvidenciaCarga
|
|
|
|
- name: combustible-gastos
|
|
entities: 5
|
|
status: entity_creada
|
|
descripcion: "Control de combustible, peajes, gastos"
|
|
modulo_simco: MAI-012
|
|
entidades:
|
|
- carga-combustible.entity.ts
|
|
- cruce-peaje.entity.ts
|
|
- gasto-viaje.entity.ts
|
|
- anticipo-viatico.entity.ts
|
|
- control-rendimiento.entity.ts
|
|
controllers: 0
|
|
services: pendiente
|
|
dtos: pendiente
|
|
notas: "Entities especializadas creadas 2026-01-25. Faltan controllers y services."
|
|
|
|
- name: tarifas-transporte
|
|
entities: 6
|
|
status: entity_creada
|
|
descripcion: "Tarifas por lane, facturacion, recargos"
|
|
modulo_simco: MAI-009
|
|
entidades:
|
|
- lane.entity.ts
|
|
- tarifa.entity.ts
|
|
- recargo-catalogo.entity.ts
|
|
- factura-transporte.entity.ts
|
|
- linea-factura.entity.ts
|
|
- fuel-surcharge.entity.ts
|
|
controllers: 0
|
|
services: pendiente
|
|
dtos: pendiente
|
|
notas: "Entities especializadas creadas 2026-01-25. Faltan controllers y services."
|
|
|
|
- name: carta-porte
|
|
entities: 7
|
|
status: entity_creada
|
|
descripcion: "Complemento Carta Porte CFDI 3.1"
|
|
modulo_simco: MAE-016
|
|
controllers: 0
|
|
services: pendiente
|
|
notas: "7 entities basicas para carta porte. Requiere validacion vs SAT."
|
|
|
|
- name: fiscal
|
|
entities: 6
|
|
status: entity_creada
|
|
descripcion: "Integracion fiscal Mexico"
|
|
controllers: 1
|
|
services: pendiente
|
|
notas: "Entities fiscales basicas."
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
# RESUMEN DE TOTALES
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
totales:
|
|
entities:
|
|
heredadas: 109
|
|
propias: 44
|
|
gps: 5
|
|
dispatch: 7
|
|
offline: 1
|
|
whatsapp: 0
|
|
total: 166
|
|
controllers:
|
|
heredados: 26
|
|
propios: 9
|
|
gps: 4
|
|
dispatch: 4
|
|
offline: 1
|
|
whatsapp: 1
|
|
total: 45
|
|
services:
|
|
heredados: "~30"
|
|
propios: 0
|
|
gps: 4
|
|
dispatch: 4
|
|
offline: 1
|
|
whatsapp: 1
|
|
total: "~40"
|
|
dtos:
|
|
heredados: "~60"
|
|
propios: 0
|
|
gps: "~15"
|
|
dispatch: "~20"
|
|
total: "~95"
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
# ANALISIS DE GAPS
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
gaps:
|
|
criticos:
|
|
- modulo: MAI-003
|
|
descripcion: "Ordenes de Transporte"
|
|
entities_requeridas:
|
|
- OrdenTransporte
|
|
- Embarque
|
|
- Parada
|
|
- RestriccionOT
|
|
- ItemOT
|
|
entities_existentes: 0
|
|
gap: 5
|
|
|
|
- modulo: MAI-004
|
|
descripcion: "Planeacion TMS"
|
|
entities_requeridas:
|
|
- Consolidacion
|
|
- AsignacionRecurso
|
|
- CapacidadRuta
|
|
entities_existentes: 0
|
|
gap: 3
|
|
|
|
- modulo: MAI-005
|
|
descripcion: "Despacho"
|
|
entities_requeridas:
|
|
- ChecklistPreViaje
|
|
- Sello
|
|
- EvidenciaCarga
|
|
- OrdenViaje
|
|
entities_existentes: 0
|
|
gap: 4
|
|
|
|
- modulo: MAI-007
|
|
descripcion: "POD y Cierre"
|
|
entities_requeridas:
|
|
- POD
|
|
- FirmaDigital
|
|
- FotoEntrega
|
|
- TiempoReal
|
|
entities_existentes: 0
|
|
gap: 4
|
|
|
|
- modulo: MAI-011
|
|
descripcion: "Gestion de Flota"
|
|
entities_requeridas:
|
|
- Unidad
|
|
- Remolque
|
|
- Operador
|
|
- LicenciaOperador
|
|
- DocumentoUnidad
|
|
- DisponibilidadOperador
|
|
entities_existentes: 0
|
|
gap: 6
|
|
|
|
total_entities_faltantes: 22
|
|
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
# NOTAS Y OBSERVACIONES
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
notas:
|
|
- "CORRECCION 2026-01-27: El progreso del 40% era INCORRECTO"
|
|
- "El progreso REAL es ~15% (solo hay entities, falta implementacion)"
|
|
- "109 entities son heredadas de erp-core"
|
|
- "44 entities son propias pero muchas son GENERICAS no especializadas"
|
|
- "Las entities especializadas del giro (22+) NO EXISTEN aun"
|
|
- "Hay 11 entities nuevas especializadas creadas 2026-01-25 (combustible + tarifas)"
|
|
- "Faltan services, DTOs, validaciones para todas las entities propias"
|
|
- "TASK-007: Se identificaron 7 gaps criticos con solucion en erp-mecanicas-diesel"
|
|
- "VER: docs/_definitions/SERVICES-CATALOG.md para listado completo de services"
|
|
|
|
historial:
|
|
- fecha: "2026-01-25"
|
|
autor: "META-ORQUESTADOR"
|
|
cambio: "Creacion inicial"
|
|
|
|
- fecha: "2026-01-27"
|
|
autor: "AUDITOR"
|
|
cambio: |
|
|
CORRECCION CRITICA: Reescritura completa con estado real.
|
|
- Porcentaje corregido de 40% a 15%
|
|
- Separacion clara heredadas vs propias
|
|
- Identificacion de gaps criticos
|
|
- Documentacion de entities faltantes
|
|
|
|
- fecha: "2026-01-28"
|
|
autor: "Claude Code (opus-4.5)"
|
|
cambio: |
|
|
TASK-007 Sprints S1+S2:
|
|
- Sprint S1: Módulo GPS completo (5 entities, 4 services, 4 controllers)
|
|
- Sprint S2: Módulo Dispatch completo (7 entities, 4 services, 4 controllers)
|
|
- Fuente: erp-mecanicas-diesel (MMD-014 GPS, MMD-011 Dispatch)
|
|
- DDL: 03a-gps-devices-ddl.sql, 09-dispatch-schema-ddl.sql
|
|
- Porcentaje actualizado de 15% a 25%
|
|
|
|
- fecha: "2026-01-28"
|
|
autor: "Claude Code (opus-4.5)"
|
|
cambio: |
|
|
TASK-007 Sprints S4+S5:
|
|
- Sprint S4: Módulo Offline (1 entity, 1 service, 1 controller, 8 endpoints)
|
|
- Sprint S5: Módulo WhatsApp (9 templates, 1 service, 1 controller, 11 endpoints)
|
|
- Cola de prioridad con resolución de conflictos
|
|
- Templates transporte en español México
|
|
- Porcentaje actualizado de 25% a 60%
|