erp-core/docs/02-fase-core-business/README.md

279 lines
13 KiB
Markdown

# Fase 02: Core Business
**Proyecto:** ERP Core
**Fecha:** 2025-12-05
**Story Points Total:** 192 SP
**Estado:** US Documentadas
---
## Descripcion
La Fase Core Business contiene los modulos de negocio genericos reutilizables por todas las verticales del ERP. Incluye catalogos, configuraciones, auditoria, notificaciones, reportes y la base financiera.
---
## Modulos de esta Fase
| ID | Nombre | SP | RF | ET | US | Estado | Descripcion |
|----|--------|---:|---:|---:|---:|--------|-------------|
| [MGN-005](./MGN-005-catalogs/) | Catalogs | 29 | 5 | 3 | 5 | US Ready | Catalogos maestros genericos |
| [MGN-006](./MGN-006-settings/) | Settings | 26 | 4 | 3 | 4 | US Ready | Configuraciones del sistema |
| [MGN-007](./MGN-007-audit/) | Audit | 30 | 4 | 3 | 4 | US Ready | Auditoria y logs |
| [MGN-008](./MGN-008-notifications/) | Notifications | 25 | 4 | 3 | 4 | US Ready | Sistema de notificaciones |
| [MGN-009](./MGN-009-reports/) | Reports | 36 | 4 | 3 | 4 | US Ready | Reportes y dashboards |
| [MGN-010](./MGN-010-financial/) | Financial | 46 | 4 | 3 | 4 | US Ready | Base financiera |
**Total:** 192 SP | 25 RF | 18 ET | 25 US
---
## Metricas Consolidadas
| Metrica | Valor |
|---------|-------|
| Modulos | 6 |
| Requerimientos (RF) | 25 |
| Especificaciones (ET) | 18 |
| - Database | 6 |
| - Backend | 6 |
| - Frontend | 6 |
| Historias de Usuario (US) | 25 |
| Story Points | 192 |
| Tablas Database | 42 |
| Endpoints API | 95+ |
| Sprints Estimados | 4 (Sprint 4-7) |
---
## Resumen de User Stories por Modulo
### MGN-005: Catalogs (5 US, 29 SP)
| US | Titulo | SP | Sprint |
|----|--------|---:|--------|
| [US-MGN005-001](./MGN-005-catalogs/historias-usuario/US-MGN005-001.md) | Gestionar Contactos | 8 | Sprint 4 |
| [US-MGN005-002](./MGN-005-catalogs/historias-usuario/US-MGN005-002.md) | Consultar Paises y Estados | 3 | Sprint 4 |
| [US-MGN005-003](./MGN-005-catalogs/historias-usuario/US-MGN005-003.md) | Gestionar Monedas y TC | 8 | Sprint 4 |
| [US-MGN005-004](./MGN-005-catalogs/historias-usuario/US-MGN005-004.md) | Gestionar Unidades de Medida | 5 | Sprint 4 |
| [US-MGN005-005](./MGN-005-catalogs/historias-usuario/US-MGN005-005.md) | Gestionar Categorias Jerarquicas | 5 | Sprint 4 |
### MGN-006: Settings (4 US, 26 SP)
| US | Titulo | SP | Sprint |
|----|--------|---:|--------|
| [US-MGN006-001](./MGN-006-settings/historias-usuario/US-MGN006-001.md) | Configuraciones del Sistema | 5 | Sprint 4 |
| [US-MGN006-002](./MGN-006-settings/historias-usuario/US-MGN006-002.md) | Configuraciones del Tenant | 8 | Sprint 4 |
| [US-MGN006-003](./MGN-006-settings/historias-usuario/US-MGN006-003.md) | Preferencias de Usuario | 5 | Sprint 4 |
| [US-MGN006-004](./MGN-006-settings/historias-usuario/US-MGN006-004.md) | Feature Flags | 8 | Sprint 4 |
### MGN-007: Audit (4 US, 30 SP)
| US | Titulo | SP | Sprint |
|----|--------|---:|--------|
| [US-MGN007-001](./MGN-007-audit/historias-usuario/US-MGN007-001.md) | Audit Trail de Entidades | 8 | Sprint 5 |
| [US-MGN007-002](./MGN-007-audit/historias-usuario/US-MGN007-002.md) | Logs de Acceso | 8 | Sprint 5 |
| [US-MGN007-003](./MGN-007-audit/historias-usuario/US-MGN007-003.md) | Eventos de Seguridad | 8 | Sprint 5 |
| [US-MGN007-004](./MGN-007-audit/historias-usuario/US-MGN007-004.md) | Reportes de Auditoria | 6 | Sprint 5 |
### MGN-008: Notifications (4 US, 25 SP)
| US | Titulo | SP | Sprint |
|----|--------|---:|--------|
| [US-MGN008-001](./MGN-008-notifications/historias-usuario/US-MGN008-001.md) | Notificaciones In-App | 8 | Sprint 5 |
| [US-MGN008-002](./MGN-008-notifications/historias-usuario/US-MGN008-002.md) | Notificaciones por Email | 8 | Sprint 5 |
| [US-MGN008-003](./MGN-008-notifications/historias-usuario/US-MGN008-003.md) | Push Notifications | 5 | Sprint 5 |
| [US-MGN008-004](./MGN-008-notifications/historias-usuario/US-MGN008-004.md) | Preferencias de Notificacion | 4 | Sprint 5 |
### MGN-009: Reports (4 US, 36 SP)
| US | Titulo | SP | Sprint |
|----|--------|---:|--------|
| [US-MGN009-001](./MGN-009-reports/historias-usuario/US-MGN009-001.md) | Reportes Predefinidos | 10 | Sprint 6 |
| [US-MGN009-002](./MGN-009-reports/historias-usuario/US-MGN009-002.md) | Dashboards y Widgets | 13 | Sprint 6 |
| [US-MGN009-003](./MGN-009-reports/historias-usuario/US-MGN009-003.md) | Report Builder | 8 | Sprint 6 |
| [US-MGN009-004](./MGN-009-reports/historias-usuario/US-MGN009-004.md) | Reportes Programados | 5 | Sprint 6 |
### MGN-010: Financial (4 US, 46 SP)
| US | Titulo | SP | Sprint |
|----|--------|---:|--------|
| [US-MGN010-001](./MGN-010-financial/historias-usuario/US-MGN010-001.md) | Plan de Cuentas | 13 | Sprint 7 |
| [US-MGN010-002](./MGN-010-financial/historias-usuario/US-MGN010-002.md) | Monedas y Tipos de Cambio | 10 | Sprint 7 |
| [US-MGN010-003](./MGN-010-financial/historias-usuario/US-MGN010-003.md) | Periodos Contables | 10 | Sprint 7 |
| [US-MGN010-004](./MGN-010-financial/historias-usuario/US-MGN010-004.md) | Asientos Contables | 13 | Sprint 7 |
---
## Especificaciones Tecnicas por Modulo
### MGN-005: Catalogs
| ET | Archivo | Descripcion |
|----|---------|-------------|
| Database | ET-CATALOG-database.md | 7 tablas: contacts, addresses, countries, currencies, etc. |
| Backend | ET-CATALOG-backend.md | 5 servicios, 25+ endpoints |
| Frontend | ET-CATALOG-frontend.md | Componentes UI |
### MGN-006: Settings
| ET | Archivo | Descripcion |
|----|---------|-------------|
| Database | ET-SETTINGS-database.md | 6 tablas: system_settings, tenant_settings, etc. |
| Backend | ET-SETTINGS-backend.md | 4 servicios, configuracion jerarquica |
| Frontend | ET-SETTINGS-frontend.md | UI de configuracion |
### MGN-007: Audit
| ET | Archivo | Descripcion |
|----|---------|-------------|
| Database | ET-AUDIT-database.md | 6 tablas con particionamiento |
| Backend | ET-AUDIT-backend.md | TypeORM subscriber, interceptors |
| Frontend | ET-AUDIT-frontend.md | Log viewer, filtros avanzados, exportacion |
### MGN-008: Notifications
| ET | Archivo | Descripcion |
|----|---------|-------------|
| Database | ET-NOTIF-database.md | 6 tablas: notifications, email_templates, etc. |
| Backend | ET-NOTIF-backend.md | WebSocket gateway, Bull processors |
| Frontend | ET-NOTIF-frontend.md | NotificationCenter, WebSocket, Push API |
### MGN-009: Reports
| ET | Archivo | Descripcion |
|----|---------|-------------|
| Database | ET-REPORT-database.md | 7 tablas: report_definitions, dashboards, etc. |
| Backend | ET-REPORT-backend.md | ReportBuilder, exportacion multi-formato |
| Frontend | ET-REPORT-frontend.md | Dashboard grid, Chart.js, Report Builder |
### MGN-010: Financial
| ET | Archivo | Descripcion |
|----|---------|-------------|
| Database | ET-FIN-database.md | 10 tablas: accounts, journal_entries, etc. |
| Backend | ET-FIN-backend.md | JournalService, validaciones contables |
| Frontend | ET-FIN-frontend.md | Account tree, Journal form, Decimal.js |
---
## Arquitectura de la Fase
```
┌─────────────────────────────────────────┐
│ FASE 01: FOUNDATION │
│ (Auth, Users, Roles, Tenants) │
└─────────────────┬───────────────────────┘
┌─────────────────────────────┼─────────────────────────────┐
│ │ │
▼ ▼ ▼
┌───────────────────┐ ┌───────────────────┐ ┌───────────────────┐
│ MGN-005 CATALOGS │ │ MGN-006 SETTINGS │ │ MGN-007 AUDIT │
│ │ │ │ │ │
│ - Contactos │ │ - System Config │ │ - Audit Trail │
│ - Paises/Estados │ │ - Tenant Config │ │ - Access Logs │
│ - Monedas │ │ - User Prefs │ │ - Security Events │
│ - UoM │ │ - Feature Flags │ │ - Reports │
│ - Categorias │ │ │ │ │
└─────────┬─────────┘ └─────────┬─────────┘ └─────────┬─────────┘
│ │ │
└─────────────────────────┼─────────────────────────┘
┌───────────────────────────┼───────────────────────────┐
│ │ │
▼ ▼ ▼
┌───────────────────┐ ┌───────────────────┐ ┌───────────────────┐
│ MGN-008 NOTIF │ │ MGN-009 REPORTS │ │ MGN-010 FINANCIAL │
│ │ │ │ │ │
│ - In-App │ │ - Predefinidos │ │ - Plan Cuentas │
│ - Email │ │ - Dashboards │ │ - Monedas/TC │
│ - Push │ │ - Builder │ │ - Periodos │
│ - Preferencias │ │ - Programados │ │ - Asientos │
└───────────────────┘ └───────────────────┘ └───────────────────┘
┌───────────────────────┐
│ VERTICALES │
│ (Facturacion, CxC, │
│ CxP, Tesoreria...) │
└───────────────────────┘
```
---
## Roadmap de Sprints
| Sprint | Modulos | SP | Descripcion |
|--------|---------|---:|-------------|
| Sprint 4 | MGN-005, MGN-006 | 55 | Catalogos y Configuraciones |
| Sprint 5 | MGN-007, MGN-008 | 55 | Auditoria y Notificaciones |
| Sprint 6 | MGN-009 | 36 | Reportes y Dashboards |
| Sprint 7 | MGN-010 | 46 | Base Financiera |
---
## Estructura GAMILIT por Modulo
```
MGN-XXX-{nombre}/
├── _MAP.md # Indice del modulo
├── README.md # Descripcion
├── requerimientos/ # RF documentados
│ ├── INDICE-RF-XXX.md # Indice de RF
│ └── RF-XXX-NNN.md # Requerimiento individual
├── especificaciones/ # ET documentadas
│ ├── INDICE-ET-XXX.md # Indice de ET
│ ├── ET-XXX-database.md # Modelo de datos
│ ├── ET-XXX-backend.md # Servicios y API
│ └── ET-XXX-frontend.md # Componentes UI
├── historias-usuario/ # US documentadas
│ ├── INDICE-US-XXX.md # Indice de US
│ └── US-MGNXXX-NNN.md # Historia individual
└── implementacion/
└── TRACEABILITY.yml # Trazabilidad RF->Codigo
```
---
## Criterios de Completitud de Fase
### Documentacion
- [x] RF documentados para todos los modulos (25/25)
- [x] ET documentadas para todos los modulos (18/18)
- Database: 6, Backend: 6, Frontend: 6
- [x] US documentadas con criterios de aceptacion (25/25)
### Implementacion
- [ ] MGN-005 Catalogs: Implementado
- [ ] MGN-006 Settings: Implementado
- [ ] MGN-007 Audit: Implementado
- [ ] MGN-008 Notifications: Implementado
- [ ] MGN-009 Reports: Implementado
- [ ] MGN-010 Financial: Implementado
### Calidad
- [ ] Integracion entre modulos verificada
- [ ] Tests con coverage > 80%
- [ ] Documentacion 100% actualizada
---
## Proximos Pasos
1. ~~**Documentar RF** para todos los modulos~~
2. ~~**Crear ET** para todos los modulos~~
3. ~~**Definir US** con criterios de aceptacion~~
4. ~~**Crear ET Frontend** para todos los modulos~~
5. **Actualizar TRACEABILITY.yml** con rutas finales post-implementacion
6. **Iniciar implementacion** Sprint 4
---
## Documentos Relacionados
- [MASTER_INVENTORY.yml](../../orchestration/inventarios/MASTER_INVENTORY.yml)
- [TRACEABILITY_MATRIX.yml](../../orchestration/inventarios/TRACEABILITY_MATRIX.yml)
- [DEPENDENCY_GRAPH.yml](../../orchestration/inventarios/DEPENDENCY_GRAPH.yml)
- [Fase 01 Foundation](../01-fase-foundation/README.md)
---
**Generado por:** Requirements-Analyst
**Fecha:** 2025-12-05
**Version:** 4.0 - RF + ET + ET Frontend + US Documentados