# ANALISIS COMPLETO DEL PROYECTO ERP-CORE **ID:** ANALISIS-COMPLETO-2026-01-10 **Fecha:** 2026-01-10 **Version:** 1.0 **Sistema:** SIMCO v3.5 + CAPVED **Orquestador:** Claude Code - Opus 4.5 **Fase:** A (Analisis) - FASE 2 --- ## RESUMEN EJECUTIVO Este documento presenta un analisis exhaustivo del proyecto ERP-Core para identificar todos los gaps de desarrollo, datos hardcodeados, seeds faltantes, y tests pendientes. ### Metricas Clave | Categoria | Total | Cubierto | Pendiente | % Completado | |-----------|-------|----------|-----------|--------------| | Servicios Backend | 76 | 30 | 46 | 39.5% | | Servicios Frontend API | 20 | 12 | 8 | 60% | | Tablas DDL | 177 | 25 | 152 | 14.1% | | Seeds Requeridos | 45 | 7 | 38 | 15.5% | | Tests Unitarios | 903 | 903 | ~1200 | ~43% | --- ## 1. ANALISIS FRONTEND ### 1.1 Datos Hardcodeados (Intencionados - Configuracion) Estos son valores de configuracion que estan correctamente hardcodeados como constantes del sistema: | Archivo | Lineas | Descripcion | Estado | |---------|--------|-------------|--------| | `dashboards/types/index.ts` | 27-43, 251-267 | WIDGET_TYPES, WIDGET_DEFAULT_SIZES | OK | | `scheduled-reports/types/index.ts` | 146-192 | CRON_PRESETS, TIMEZONES, DELIVERY_METHODS, EXPORT_FORMATS | OK | | `shared/constants/roles.ts` | 1-40 | ROLES, ROLE_LABELS, ROLE_HIERARCHY | OK | | `shared/constants/status.ts` | 2-72 | DOCUMENT_STATUS, INVOICE_STATUS, LEAD_STATUS, etc. | OK | | `shared/constants/api-endpoints.ts` | 1-94 | API endpoint mappings | OK | ### 1.2 Datos Hardcodeados (Formularios - Defaults) Valores por defecto en formularios que podrian provenir de API: | Archivo | Lineas | Datos | Accion Requerida | |---------|--------|-------|------------------| | `partners/components/PartnerForm.tsx` | 35-43, 76, 85 | partnerTypeOptions, languageOptions, defaults | EVALUAR - Podrian venir de config API | | `tenants/components/TenantForm.tsx` | 80-86, 98-100 | plan, maxUsers, timezone, currency, language defaults | EVALUAR - Podrian venir de config API | | `audit/components/AuditLogFilters.tsx` | 17-22 | actionOptions (INSERT, UPDATE, DELETE) | OK - Son enums fijos | ### 1.3 TODOs Pendientes en Frontend | Archivo | Linea | TODO | Prioridad | |---------|-------|------|-----------| | `pages/catalogs/categories/CategoryDetailPage.tsx` | 113 | `productCount: 0, // TODO: Get from API when available` | MEDIA | ### 1.4 Servicios API Faltantes en Frontend **CRITICO - 8 modulos sin servicios API implementados:** | Modulo | Archivo Esperado | Endpoints Definidos | Prioridad | |--------|------------------|---------------------|-----------| | Products | `products/api/products.api.ts` | INVENTORY.PRODUCTS | CRITICA | | Inventory | `inventory/api/inventory.api.ts` | INVENTORY.* (8 endpoints) | CRITICA | | Sales | `sales/api/sales.api.ts` | SALES.* (3 endpoints) | CRITICA | | Purchases | `purchases/api/purchases.api.ts` | PURCHASES.* (2 endpoints) | CRITICA | | Projects | `projects/api/projects.api.ts` | PROJECTS.* (5 endpoints) | MEDIA | | CRM | `crm/api/crm.api.ts` | CRM.* (4 endpoints) | MEDIA | | HR | `hr/api/hr.api.ts` | HR.* (6 endpoints) | MEDIA | | System | `system/api/system.api.ts` | SYSTEM.* (4 endpoints) | BAJA | ### 1.5 Servicios API Implementados (12) | Servicio | Archivo | Endpoints | Estado | |----------|---------|-----------|--------| | Auth API | `services/api/auth.api.ts` | 7 | COMPLETO | | Financial API | `features/financial/api/financial.api.ts` | 40+ | COMPLETO | | Catalogs API | `features/catalogs/api/catalogs.api.ts` | 30+ | COMPLETO | | Users API | `features/users/api/users.api.ts` | 8 | COMPLETO | | Partners API | `features/partners/api/partners.api.ts` | 10 | COMPLETO | | Companies API | `features/companies/api/companies.api.ts` | 6 | COMPLETO | | Audit API | `features/audit/api/audit.api.ts` | 12 | COMPLETO | | Notifications API | `features/notifications/api/notifications.api.ts` | 8 | COMPLETO | | Dashboards API | `features/dashboards/api/dashboards.api.ts` | 10 | COMPLETO | | Report Builder API | `features/report-builder/api/report-builder.api.ts` | 8 | COMPLETO | | Scheduled Reports API | `features/scheduled-reports/api/scheduled-reports.api.ts` | 10 | COMPLETO | | Tenants API | `features/tenants/api/tenants.api.ts` | 8 | COMPLETO | --- ## 2. ANALISIS BACKEND ### 2.1 TODOs Criticos Pendientes | ID | Archivo | Linea | Descripcion | Impacto | Prioridad | |----|---------|-------|-------------|---------|-----------| | TODO-001 | `sales/quotations.service.ts` | 416 | `const amountTax = 0; // TODO: Calculate taxes` | Impuestos no calculados en cotizaciones | CRITICA | | TODO-002 | `sales/orders.service.ts` | 466 | `const amountTax = 0; // TODO: Calculate taxes` | Impuestos no calculados en ordenes | CRITICA | | TODO-003 | `sales/quotations.service.ts` | 478 | `// TODO: Send email notification` | Emails no enviados al cliente | ALTA | | TODO-004 | `shared/middleware/auth.middleware.ts` | 81 | `// TODO: Check permission in database` | Permisos granulares no validados | ALTA | | TODO-005 | `shared/services/email.service.ts` | 66 | `// TODO: Implement actual email sending` | Solo mock en desarrollo | ALTA | | TODO-006 | `reports/scheduler.service.ts` | 360 | `// TODO: Integrate with notifications.service` | Reportes sin notificaciones | MEDIA | ### 2.2 Servicios por Modulo #### AUTH (8 servicios) | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | auth.service.ts | 23 | COMPLETO | - | | mfa.service.ts | 45 | COMPLETO | - | | permission-cache.service.ts | - | INCLUIDO | - | | trusted-devices.service.ts | 41 | COMPLETO | - | | apiKeys.service.ts | 0 | SIN TESTS | ALTA | | email-verification.service.ts | 0 | SIN TESTS | MEDIA | | token.service.ts | 0 | SIN TESTS | ALTA | | oauth.service.ts | 0 | SIN TESTS | MEDIA | #### CORE (7 servicios) | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | countries.service.ts | 19 | COMPLETO | - | | currencies.service.ts | 21 | COMPLETO | - | | currency-rates.service.ts | 19 | COMPLETO | - | | states.service.ts | 25 | COMPLETO | - | | uom.service.ts | 33 | COMPLETO | - | | product-categories.service.ts | 0 | SIN TESTS | ALTA | | sequences.service.ts | 0 | SIN TESTS | CRITICA | #### FINANCIAL (11 servicios) | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | accounts.service.ts | 36 | COMPLETO | - | | invoices.service.ts | 31 | COMPLETO | - | | journal-entries.service.ts | 27 | COMPLETO | - | | payments.service.ts | 37 | COMPLETO | - | | fiscalPeriods.service.ts | 0 | SIN TESTS | ALTA | | incoterms.service.ts | 0 | SIN TESTS | BAJA | | journals.service.ts | 0 | SIN TESTS | MEDIA | | payment-methods.service.ts | 0 | SIN TESTS | MEDIA | | payment-terms.service.ts | 0 | SIN TESTS | MEDIA | | reconcile-models.service.ts | 0 | SIN TESTS | CRITICA | | taxes.service.ts | 0 | SIN TESTS | CRITICA | #### INVENTORY (9 servicios) | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | products.service.ts | 32 | COMPLETO | - | | stock-quants.service.ts | 37 | COMPLETO | - | | valuation.service.ts | 37 | COMPLETO | - | | adjustments.service.ts | 0 | SIN TESTS | ALTA | | locations.service.ts | 0 | SIN TESTS | ALTA | | lots.service.ts | 0 | SIN TESTS | MEDIA | | package-types.service.ts | 0 | SIN TESTS | BAJA | | pickings.service.ts | 0 | SIN TESTS | ALTA | | warehouses.service.ts | 0 | SIN TESTS | ALTA | #### SALES (5 servicios) - 0% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | orders.service.ts | 0 | SIN TESTS | CRITICA | | quotations.service.ts | 0 | SIN TESTS | CRITICA | | customer-groups.service.ts | 0 | SIN TESTS | MEDIA | | pricelists.service.ts | 0 | SIN TESTS | ALTA | | sales-teams.service.ts | 0 | SIN TESTS | BAJA | #### PURCHASES (2 servicios) - 0% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | purchases.service.ts | 0 | SIN TESTS | CRITICA | | rfqs.service.ts | 0 | SIN TESTS | CRITICA | #### HR (7 servicios) - 28.6% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | expenses.service.ts | 20 | COMPLETO | - | | skills.service.ts | 17 | COMPLETO | - | | contracts.service.ts | 0 | SIN TESTS | ALTA | | departments.service.ts | 0 | SIN TESTS | MEDIA | | employees.service.ts | 0 | SIN TESTS | ALTA | | leaves.service.ts | 0 | SIN TESTS | ALTA | | payslips.service.ts | 0 | SIN TESTS | CRITICA | #### AUDIT (3 servicios) - 0% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | access-logs.service.ts | 0 | SIN TESTS | ALTA | | audit.service.ts | 0 | SIN TESTS | ALTA | | security-events.service.ts | 0 | SIN TESTS | ALTA | #### REPORTS (6 servicios) - 0% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | reports.service.ts | 0 | SIN TESTS | MEDIA | | dashboards.service.ts | 0 | SIN TESTS | MEDIA | | report-builder.service.ts | 0 | SIN TESTS | MEDIA | | export.service.ts | 0 | SIN TESTS | MEDIA | | pdf.service.ts | 0 | SIN TESTS | BAJA | | scheduler.service.ts | 0 | SIN TESTS | MEDIA | #### PROJECTS (3 servicios) - 0% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | projects.service.ts | 0 | SIN TESTS | MEDIA | | tasks.service.ts | 0 | SIN TESTS | MEDIA | | timesheets.service.ts | 0 | SIN TESTS | MEDIA | #### CRM (4 servicios) - 0% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | leads.service.ts | 0 | SIN TESTS | MEDIA | | opportunities.service.ts | 0 | SIN TESTS | MEDIA | | stages.service.ts | 0 | SIN TESTS | BAJA | | tags.service.ts | 0 | SIN TESTS | BAJA | #### ROLES (2 servicios) - 100% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | roles.service.ts | 29 | COMPLETO | - | | permissions.service.ts | 42 | COMPLETO | - | #### USERS (1 servicio) - 100% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | users.service.ts | 45 | COMPLETO | - | #### TENANTS (1 servicio) - 100% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | tenants.service.ts | 44 | COMPLETO | - | #### COMPANIES (1 servicio) - 0% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | companies.service.ts | 0 | SIN TESTS | ALTA | #### PARTNERS (2 servicios) - 50% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | partners.service.ts | 26 | COMPLETO | - | | ranking.service.ts | 0 | SIN TESTS | BAJA | #### SYSTEM (4 servicios) - 25% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | settings.service.ts | 28 | COMPLETO | - | | activities.service.ts | 0 | SIN TESTS | MEDIA | | messages.service.ts | 0 | SIN TESTS | MEDIA | | notifications.service.ts | 0 | SIN TESTS | MEDIA | #### SHARED (3 servicios) - 0% COBERTURA | Servicio | Tests | Estado | Prioridad Fix | |----------|-------|--------|---------------| | base.service.ts | 0 | SIN TESTS | ALTA | | cache.service.ts | 0 | SIN TESTS | MEDIA | | email.service.ts | 0 | SIN TESTS | ALTA | --- ## 3. ANALISIS DATABASE SEEDS ### 3.1 Seeds Existentes (7 archivos) | Archivo | Tablas Cubiertas | Estado | |---------|------------------|--------| | `00-catalogs.sql` | currencies (3), countries (5), uom_categories (5), uom (15) | OK | | `00b-states.sql` | states (131 registros) | OK | | `01-tenants.sql` | tenants (2) | OK - IDs hardcodeados | | `02-companies.sql` | companies (3) | OK - IDs hardcodeados | | `03-roles.sql` | roles (8), permissions (28), role_permissions | OK | | `04-users.sql` | users (6), user_roles | OK - Password expuesto | | `05-sample-data.sql` | partners (2) | INCOMPLETO | ### 3.2 Seeds CRITICOS Faltantes #### FINANCIAL - BLOQUEO TOTAL (0/21 tablas) | Tabla | Prioridad | Descripcion | Registros Minimos | |-------|-----------|-------------|-------------------| | account_types | CRITICA | Tipos de cuenta contable | 10 | | accounts | CRITICA | Catalogo de cuentas (COA) | 50+ | | journals | CRITICA | Diarios contables | 5 | | fiscal_years | CRITICA | Ejercicios fiscales | 2 | | fiscal_periods | CRITICA | Periodos fiscales | 24 (2 anios x 12) | | taxes | CRITICA | Configuracion de impuestos | 5 (IVA, ISR, etc) | | payment_terms | ALTA | Terminos de pago | 5 | | payment_methods | ALTA | Metodos de pago | 5 | | incoterms | MEDIA | Terminos comercio internacional | 11 | #### INVENTORY - BLOQUEO TOTAL (0/33 tablas) | Tabla | Prioridad | Descripcion | Registros Minimos | |-------|-----------|-------------|-------------------| | products | CRITICA | Productos | 20 | | warehouses | CRITICA | Almacenes | 2 | | locations | CRITICA | Ubicaciones de almacen | 10 | | picking_types | ALTA | Tipos de movimiento | 3 | | package_types | BAJA | Tipos de empaque | 3 | | product_categories | CRITICA | Categorias de producto | 10 | #### SALES - BLOQUEO TOTAL (0/12 tablas) | Tabla | Prioridad | Descripcion | Registros Minimos | |-------|-----------|-------------|-------------------| | pricelists | CRITICA | Listas de precio | 3 | | pricelist_items | ALTA | Items de lista de precio | 50 | | sales_teams | MEDIA | Equipos de venta | 2 | | customer_groups | MEDIA | Grupos de clientes | 3 | #### PURCHASES - BLOQUEO TOTAL (0/9 tablas) | Tabla | Prioridad | Descripcion | Registros Minimos | |-------|-----------|-------------|-------------------| | vendor_pricelists | ALTA | Listas de precio proveedor | 2 | #### CORE - INCOMPLETO | Tabla | Prioridad | Descripcion | Registros Minimos | |-------|-----------|-------------|-------------------| | sequences | CRITICA | Secuencias de numeracion | 15 (SO, PO, INV, etc) | | product_categories | CRITICA | Categorias | 10 | | addresses | ALTA | Direcciones de partners | 4 | ### 3.3 Problemas de Calidad en Seeds Existentes | Problema | Archivos Afectados | Riesgo | Solucion | |----------|-------------------|--------|----------| | UUIDs hardcodeados | Todos | ALTO - Conflicto en produccion | Usar gen_random_uuid() | | Tenant IDs fijos | users, roles, permissions | ALTO - No multi-tenant testing | Parametrizar | | Password hash expuesto | 04-users.sql | CRITICO - Seguridad | Mover a variable de entorno | | Datos incompletos | 05-sample-data.sql | MEDIO - Solo 2 partners | Agregar mas datos | --- ## 4. ANALISIS DE TESTS ### 4.1 Resumen de Cobertura | Modulo | Servicios | Con Tests | Sin Tests | % Cobertura | |--------|-----------|-----------|-----------|-------------| | Auth | 8 | 5 | 3 | 62.5% | | Core | 7 | 5 | 2 | 71.4% | | Financial | 11 | 4 | 7 | 36.4% | | Inventory | 9 | 3 | 6 | 33.3% | | Sales | 5 | 0 | 5 | 0% | | Purchases | 2 | 0 | 2 | 0% | | HR | 7 | 2 | 5 | 28.6% | | Audit | 3 | 0 | 3 | 0% | | Reports | 6 | 0 | 6 | 0% | | Projects | 3 | 0 | 3 | 0% | | CRM | 4 | 0 | 4 | 0% | | Roles | 2 | 2 | 0 | 100% | | Users | 1 | 1 | 0 | 100% | | Tenants | 1 | 1 | 0 | 100% | | Companies | 1 | 0 | 1 | 0% | | Partners | 2 | 1 | 1 | 50% | | System | 4 | 1 | 3 | 25% | | Shared | 3 | 0 | 3 | 0% | | **TOTAL** | **76** | **30** | **46** | **39.5%** | ### 4.2 Tests Existentes (Detalle) | Test File | Tests | Suites | Estado | |-----------|-------|--------|--------| | auth.service.spec.ts | 23 | 8 | PASS | | mfa.service.spec.ts | 45 | 10 | PASS | | trusted-devices.service.spec.ts | 41 | 8 | PASS | | countries.service.spec.ts | 19 | 5 | PASS | | currencies.service.spec.ts | 21 | 5 | PASS | | currency-rates.service.spec.ts | 19 | 5 | PASS | | states.service.spec.ts | 25 | 6 | PASS | | uom.service.spec.ts | 33 | 7 | PASS | | accounts.service.spec.ts | 36 | 9 | PASS | | invoices.service.spec.ts | 31 | 9 | PASS | | journal-entries.service.spec.ts | 27 | 8 | PASS | | payments.service.spec.ts | 37 | 11 | PASS | | products.service.spec.ts | 32 | 9 | PASS | | stock.service.spec.ts | 37 | 12 | PASS | | valuation.service.spec.ts | 37 | 10 | PASS | | roles.service.spec.ts | 29 | 12 | PASS | | permissions.service.spec.ts | 42 | 14 | PASS | | users.service.spec.ts | 45 | 11 | PASS | | tenants.service.spec.ts | 44 | 14 | PASS | | expenses.service.spec.ts | 20 | 15 | PASS | | skills.service.spec.ts | 17 | 12 | PASS | | partners.service.spec.ts | 26 | 10 | PASS | | settings.service.spec.ts | 28 | 9 | PASS | | **TOTAL** | **903** | **~220** | - | ### 4.3 Tests de Integracion Existentes | Test File | Descripcion | Estado | |-----------|-------------|--------| | auth.integration.test.ts | Autenticacion con DB | PASS | | financial.integration.test.ts | Operaciones financieras | PASS | | inventory.integration.test.ts | Operaciones de inventario | PASS | | partners.integration.test.ts | Operaciones de partners | PASS | ### 4.4 Tests E2E | Estado | Descripcion | |--------|-------------| | NO EXISTE | No hay tests E2E con Playwright u otro framework | --- ## 5. DEPENDENCIAS ENTRE MODULOS ### 5.1 Diagrama de Dependencias ``` ┌─────────────┐ │ TENANTS │ └──────┬──────┘ │ ┌────────────┼────────────┐ ▼ ▼ ▼ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ AUTH │ │ CORE │ │ ROLES │ └────┬────┘ └────┬────┘ └────┬────┘ │ │ │ ┌────────┼────────────┼────────────┤ ▼ ▼ ▼ ▼ ┌───────┐┌───────┐ ┌─────────────┐┌───────┐ │ USERS ││PARTNERS│ │ COMPANIES ││SYSTEM │ └───┬───┘└───┬───┘ └──────┬──────┘└───────┘ │ │ │ └────────┼─────────────┘ ▼ ┌────────────────┐ │ FINANCIAL │◄─────────────────────┐ │ (accounts, │ │ │ journals, │ │ │ taxes) │ │ └───────┬────────┘ │ │ │ ┌───────┴───────┐ │ ▼ ▼ │ ┌───────┐ ┌───────────┐ │ │INVOICES│ │ PAYMENTS │ │ └───────┘ └───────────┘ │ │ ┌─────────────────────────────────────┐ │ │ INVENTORY │ │ │ (products, warehouses, locations, │─────┤ │ stock_quants, pickings) │ │ └─────────────────────────────────────┘ │ │ ┌────────────────────────────────────┐ │ │ SALES │──────┤ │ (quotations, orders, pricelists) │ │ └────────────────────────────────────┘ │ │ ┌────────────────────────────────────┐ │ │ PURCHASES │──────┘ │ (rfqs, purchase_orders) │ └────────────────────────────────────┘ ``` ### 5.2 Orden de Ejecucion de Seeds ``` 1. 00-catalogs.sql # Currencies, Countries, UOMs 2. 00b-states.sql # States/Provinces 3. 01-tenants.sql # Tenants (base multi-tenancy) 4. 02-companies.sql # Companies (per tenant) 5. 03-roles.sql # Roles & Permissions 6. 04-users.sql # Users (depends on roles) 5. [NUEVO] 05-sequences.sql # Sequences (document numbering) 6. [NUEVO] 06-product-categories.sql # Product categories 7. [NUEVO] 07-financial-setup.sql # COA, Journals, Taxes, Terms 8. [NUEVO] 08-inventory-setup.sql # Warehouses, Locations, Picking Types 9. [NUEVO] 09-products.sql # Products 10. [NUEVO] 10-pricelists.sql # Price lists 11. [NUEVO] 11-sample-partners.sql # Partners with addresses 12. 05-sample-data.sql # Rename to 12-sample-data.sql ``` --- ## 6. GAPS IDENTIFICADOS ### 6.1 GAPS CRITICOS (Bloquean funcionalidad core) | ID | Categoria | Descripcion | Impacto | Esfuerzo | |----|-----------|-------------|---------|----------| | GAP-C01 | Backend | Calculo de impuestos hardcodeado a 0 | Facturas sin impuestos | 8 SP | | GAP-C02 | Database | Sin seed de catalogo de cuentas | No se puede contabilizar | 5 SP | | GAP-C03 | Database | Sin seed de fiscal years/periods | No periodos fiscales | 3 SP | | GAP-C04 | Database | Sin seed de productos | No hay productos | 5 SP | | GAP-C05 | Database | Sin seed de almacenes/ubicaciones | No se puede almacenar | 3 SP | | GAP-C06 | Database | Sin seed de secuencias | Documentos sin numero | 5 SP | | GAP-C07 | Database | Sin seed de impuestos | No se calculan impuestos | 3 SP | | GAP-C08 | Frontend | Sin API services para Inventory | Frontend no consume API | 5 SP | | GAP-C09 | Frontend | Sin API services para Sales | Frontend no consume API | 5 SP | | GAP-C10 | Frontend | Sin API services para Products | Frontend no consume API | 3 SP | ### 6.2 GAPS ALTOS (Afectan funcionalidad importante) | ID | Categoria | Descripcion | Impacto | Esfuerzo | |----|-----------|-------------|---------|----------| | GAP-A01 | Backend | Email service solo mock | Sin notificaciones | 5 SP | | GAP-A02 | Backend | Permission middleware incompleto | Sin permisos granulares | 5 SP | | GAP-A03 | Backend | Tests faltantes - Sales (5 servicios) | Sin cobertura | 13 SP | | GAP-A04 | Backend | Tests faltantes - Purchases (2 servicios) | Sin cobertura | 5 SP | | GAP-A05 | Backend | Tests faltantes - Audit (3 servicios) | Sin cobertura compliance | 8 SP | | GAP-A06 | Database | Sin seed de listas de precio | No se puede cotizar | 3 SP | | GAP-A07 | Database | Sin seed de categorias producto | No categorizar productos | 3 SP | | GAP-A08 | Frontend | Sin API services para Purchases | Frontend no consume API | 5 SP | ### 6.3 GAPS MEDIOS (Afectan funcionalidad secundaria) | ID | Categoria | Descripcion | Impacto | Esfuerzo | |----|-----------|-------------|---------|----------| | GAP-M01 | Backend | Tests faltantes - HR (5 servicios) | Sin cobertura | 13 SP | | GAP-M02 | Backend | Tests faltantes - Reports (6 servicios) | Sin cobertura | 8 SP | | GAP-M03 | Backend | Tests faltantes - Projects (3 servicios) | Sin cobertura | 8 SP | | GAP-M04 | Backend | Tests faltantes - CRM (4 servicios) | Sin cobertura | 8 SP | | GAP-M05 | Backend | Tests faltantes - Financial (7 servicios) | Sin cobertura | 18 SP | | GAP-M06 | Backend | Tests faltantes - Inventory (6 servicios) | Sin cobertura | 15 SP | | GAP-M07 | Frontend | Sin API services para Projects | Frontend no consume API | 5 SP | | GAP-M08 | Frontend | Sin API services para CRM | Frontend no consume API | 5 SP | | GAP-M09 | Frontend | Sin API services para HR | Frontend no consume API | 5 SP | ### 6.4 GAPS BAJOS (Mejoras opcionales) | ID | Categoria | Descripcion | Impacto | Esfuerzo | |----|-----------|-------------|---------|----------| | GAP-B01 | Backend | Tests faltantes - System (3 servicios) | Sin cobertura | 5 SP | | GAP-B02 | Backend | Tests faltantes - Shared (3 servicios) | Sin cobertura | 5 SP | | GAP-B03 | Frontend | CategoryDetailPage productCount hardcodeado | UI incorrecta | 1 SP | | GAP-B04 | Database | Seeds de HR, CRM, Projects | Sin datos demo | 8 SP | | GAP-B05 | Frontend | Sin API services para System | Frontend no consume API | 3 SP | | GAP-B06 | E2E | Sin tests end-to-end Playwright | Sin validacion flujos | 21 SP | --- ## 7. RESUMEN DE ESFUERZO ### Por Prioridad | Prioridad | GAPS | Story Points | % del Total | |-----------|------|--------------|-------------| | CRITICA | 10 | 45 SP | 22% | | ALTA | 8 | 47 SP | 23% | | MEDIA | 9 | 85 SP | 41% | | BAJA | 6 | 43 SP | 14% | | **TOTAL** | **33** | **220 SP** | **100%** | ### Por Categoria | Categoria | GAPS | Story Points | |-----------|------|--------------| | Backend TODOs | 6 | 23 SP | | Backend Tests | 12 | 96 SP | | Frontend API Services | 8 | 41 SP | | Database Seeds | 7 | 39 SP | | E2E Tests | 1 | 21 SP | | **TOTAL** | **34** | **220 SP** | --- ## 8. ARCHIVOS A CREAR/MODIFICAR ### 8.1 Frontend - Nuevos Servicios API (8 archivos) ``` frontend/src/features/products/api/products.api.ts frontend/src/features/inventory/api/inventory.api.ts frontend/src/features/sales/api/sales.api.ts frontend/src/features/purchases/api/purchases.api.ts frontend/src/features/projects/api/projects.api.ts frontend/src/features/crm/api/crm.api.ts frontend/src/features/hr/api/hr.api.ts frontend/src/features/system/api/system.api.ts ``` ### 8.2 Backend - Archivos a Modificar (TODOs) ``` backend/src/modules/sales/quotations.service.ts # Fix tax calculation backend/src/modules/sales/orders.service.ts # Fix tax calculation backend/src/shared/middleware/auth.middleware.ts # Fix permission check backend/src/shared/services/email.service.ts # Implement production email backend/src/modules/reports/scheduler.service.ts # Integrate notifications ``` ### 8.3 Backend - Nuevos Tests (46 archivos) ``` # Auth (3) backend/src/modules/auth/__tests__/apiKeys.service.spec.ts backend/src/modules/auth/__tests__/email-verification.service.spec.ts backend/src/modules/auth/__tests__/token.service.spec.ts # Core (2) backend/src/modules/core/__tests__/product-categories.service.spec.ts backend/src/modules/core/__tests__/sequences.service.spec.ts # Financial (7) backend/src/modules/financial/__tests__/fiscalPeriods.service.spec.ts backend/src/modules/financial/__tests__/incoterms.service.spec.ts backend/src/modules/financial/__tests__/journals.service.spec.ts backend/src/modules/financial/__tests__/payment-methods.service.spec.ts backend/src/modules/financial/__tests__/payment-terms.service.spec.ts backend/src/modules/financial/__tests__/reconcile-models.service.spec.ts backend/src/modules/financial/__tests__/taxes.service.spec.ts # Inventory (6) backend/src/modules/inventory/__tests__/adjustments.service.spec.ts backend/src/modules/inventory/__tests__/locations.service.spec.ts backend/src/modules/inventory/__tests__/lots.service.spec.ts backend/src/modules/inventory/__tests__/package-types.service.spec.ts backend/src/modules/inventory/__tests__/pickings.service.spec.ts backend/src/modules/inventory/__tests__/warehouses.service.spec.ts # Sales (5) backend/src/modules/sales/__tests__/orders.service.spec.ts backend/src/modules/sales/__tests__/quotations.service.spec.ts backend/src/modules/sales/__tests__/customer-groups.service.spec.ts backend/src/modules/sales/__tests__/pricelists.service.spec.ts backend/src/modules/sales/__tests__/sales-teams.service.spec.ts # Purchases (2) backend/src/modules/purchases/__tests__/purchases.service.spec.ts backend/src/modules/purchases/__tests__/rfqs.service.spec.ts # HR (5) backend/src/modules/hr/__tests__/contracts.service.spec.ts backend/src/modules/hr/__tests__/departments.service.spec.ts backend/src/modules/hr/__tests__/employees.service.spec.ts backend/src/modules/hr/__tests__/leaves.service.spec.ts backend/src/modules/hr/__tests__/payslips.service.spec.ts # Audit (3) backend/src/modules/audit/__tests__/access-logs.service.spec.ts backend/src/modules/audit/__tests__/audit.service.spec.ts backend/src/modules/audit/__tests__/security-events.service.spec.ts # Reports (6) backend/src/modules/reports/__tests__/reports.service.spec.ts backend/src/modules/reports/__tests__/dashboards.service.spec.ts backend/src/modules/reports/__tests__/report-builder.service.spec.ts backend/src/modules/reports/__tests__/export.service.spec.ts backend/src/modules/reports/__tests__/pdf.service.spec.ts backend/src/modules/reports/__tests__/scheduler.service.spec.ts # Projects (3) backend/src/modules/projects/__tests__/projects.service.spec.ts backend/src/modules/projects/__tests__/tasks.service.spec.ts backend/src/modules/projects/__tests__/timesheets.service.spec.ts # CRM (4) backend/src/modules/crm/__tests__/leads.service.spec.ts backend/src/modules/crm/__tests__/opportunities.service.spec.ts backend/src/modules/crm/__tests__/stages.service.spec.ts backend/src/modules/crm/__tests__/tags.service.spec.ts # Companies (1) backend/src/modules/companies/__tests__/companies.service.spec.ts # Partners (1) backend/src/modules/partners/__tests__/ranking.service.spec.ts # System (3) backend/src/modules/system/__tests__/activities.service.spec.ts backend/src/modules/system/__tests__/messages.service.spec.ts backend/src/modules/system/__tests__/notifications.service.spec.ts # Shared (3) backend/src/shared/__tests__/base.service.spec.ts backend/src/shared/__tests__/cache.service.spec.ts backend/src/shared/__tests__/email.service.spec.ts ``` ### 8.4 Database - Nuevos Seeds (7 archivos) ``` database/seeds/05-sequences.sql database/seeds/06-product-categories.sql database/seeds/07-financial-setup.sql database/seeds/08-inventory-setup.sql database/seeds/09-products.sql database/seeds/10-pricelists.sql database/seeds/11-sample-partners.sql ``` --- ## 9. CONCLUSION El proyecto ERP-Core tiene una base solida pero presenta gaps significativos: 1. **Backend:** 60.5% de servicios sin tests, 6 TODOs criticos pendientes 2. **Frontend:** 8 servicios API faltantes para consumir endpoints existentes 3. **Database:** 85% de tablas sin seeds, modulos completos sin datos iniciales 4. **E2E:** Sin tests de extremo a extremo **Esfuerzo total estimado:** 220 Story Points **Recomendacion:** Priorizar los 10 GAPS CRITICOS (45 SP) que bloquean funcionalidad core antes de continuar con GAPS de menor prioridad. --- **Documento generado por:** ORQUESTADOR (Claude Code Opus 4.5) **Sistema:** SIMCO v3.5 + CAPVED **Fase:** A (Analisis) - COMPLETADA **Siguiente fase:** P (Planeacion)