311 lines
11 KiB
Markdown
311 lines
11 KiB
Markdown
# ESTADO DEL PROYECTO - ERP Construccion
|
|
|
|
**Proyecto:** ERP Construccion (Proyecto Independiente)
|
|
**Estado:** 🚧 En desarrollo
|
|
**Progreso:** 60%
|
|
**Ultima actualizacion:** 2025-12-12
|
|
|
|
---
|
|
|
|
## 🆕 CAMBIOS RECIENTES (2025-12-12)
|
|
|
|
### Documentacion Tecnica - COMPLETADA
|
|
|
|
- ✅ **Documentacion de Arquitectura**
|
|
- `docs/ARCHITECTURE.md` - Arquitectura tecnica para desarrolladores
|
|
- Patrones de codigo (Entity, Service, DTO)
|
|
- Configuracion multi-tenant RLS
|
|
- Guia de debugging y performance
|
|
|
|
- ✅ **Guia de Contribucion**
|
|
- `CONTRIBUTING.md` - Guia completa para desarrolladores
|
|
- Convenciones de codigo y nomenclatura
|
|
- Flujo de trabajo con Git
|
|
- Estructura de commits y PRs
|
|
|
|
- ✅ **Documentacion de API**
|
|
- `docs/api/openapi.yaml` - Especificacion OpenAPI 3.0.3
|
|
- `docs/backend/API-REFERENCE.md` - Referencia de endpoints
|
|
- Ejemplos de request/response
|
|
- Codigos de error y rate limiting
|
|
|
|
- ✅ **Documentacion de Modulos**
|
|
- `docs/backend/MODULES.md` - Documentacion detallada
|
|
- Entidades y campos de cada modulo
|
|
- Metodos de servicios
|
|
- Ejemplos de uso
|
|
|
|
### Fase 2: Backend Core Modules - COMPLETADA
|
|
|
|
- ✅ **MAI-003 Presupuestos - Entidades y Services**
|
|
- `Concepto` entity - Catálogo jerárquico de conceptos
|
|
- `Presupuesto` entity - Presupuestos versionados
|
|
- `PresupuestoPartida` entity - Líneas de presupuesto
|
|
- `ConceptoService` - Árbol de conceptos, búsqueda
|
|
- `PresupuestoService` - CRUD, versionamiento, aprobación
|
|
|
|
- ✅ **MAI-005 Control de Obra - Entidades y Services**
|
|
- `AvanceObra` entity - Avances físicos
|
|
- `FotoAvance` entity - Evidencias fotográficas con GPS
|
|
- `BitacoraObra` entity - Bitácora diaria
|
|
- `ProgramaObra` entity - Programa maestro
|
|
- `ProgramaActividad` entity - WBS/Actividades
|
|
- `AvanceObraService` - Workflow captura→revisión→aprobación
|
|
- `BitacoraObraService` - Entradas secuenciales, estadísticas
|
|
|
|
- ✅ **MAI-008 Estimaciones - Entidades y Services**
|
|
- `Estimacion` entity - Estimaciones periódicas
|
|
- `EstimacionConcepto` entity - Líneas con acumulados
|
|
- `Generador` entity - Números generadores
|
|
- `Anticipo` entity - Anticipos con amortización
|
|
- `Amortizacion` entity - Descuentos por estimación
|
|
- `Retencion` entity - Fondo de garantía, impuestos
|
|
- `FondoGarantia` entity - Acumulado por contrato
|
|
- `EstimacionWorkflow` entity - Historial de estados
|
|
- `EstimacionService` - Workflow completo, cálculo de totales
|
|
|
|
- ✅ **Módulo Auth - JWT + Refresh Tokens**
|
|
- `AuthService` - Login, register, refresh, logout
|
|
- `AuthMiddleware` - Autenticación, autorización por roles
|
|
- DTOs tipados para todas las operaciones
|
|
- Configuración de RLS con tenant_id
|
|
|
|
- ✅ **Base Service Pattern**
|
|
- `BaseService<T>` - CRUD multi-tenant genérico
|
|
- Paginación con metadata
|
|
- Soft delete con audit columns
|
|
- Contexto de servicio (tenantId, userId)
|
|
|
|
### Fase 1: Fundamentos Arquitectonicos - COMPLETADA
|
|
|
|
- ✅ **Sistema SSOT implementado**
|
|
- `database.constants.ts` - Schemas, tablas, columnas
|
|
- `api.constants.ts` - Rutas API centralizadas
|
|
- `enums.constants.ts` - Todos los enums del sistema
|
|
- Index actualizado con exports centralizados
|
|
|
|
- ✅ **Path Aliases configurados** (ya existian)
|
|
- `@shared/*`, `@modules/*`, `@config/*`, `@types/*`, `@utils/*`
|
|
|
|
- ✅ **Docker + docker-compose**
|
|
- PostgreSQL 15 + PostGIS
|
|
- Redis 7
|
|
- Backend Node.js
|
|
- Frontend React + Vite
|
|
- Adminer (dev)
|
|
- Mailhog (dev)
|
|
|
|
- ✅ **CI/CD GitHub Actions**
|
|
- Lint & Type Check
|
|
- Validate SSOT Constants
|
|
- Unit Tests (Backend + Frontend)
|
|
- Build Check
|
|
- Docker Build
|
|
|
|
- ✅ **Scripts de validacion**
|
|
- `validate-constants-usage.ts` - Detecta hardcoding
|
|
- `sync-enums.ts` - Sincroniza Backend → Frontend
|
|
|
|
- ✅ **Documentacion de DB**
|
|
- `database/_MAP.md` - Mapa completo de schemas
|
|
|
|
---
|
|
|
|
## 📊 RESUMEN EJECUTIVO
|
|
|
|
| Área | Implementado | Documentado | Estado |
|
|
|------|-------------|-------------|--------|
|
|
| **DDL/Schemas** | 7 schemas, 110 tablas | 7 schemas, 110 tablas | 100% |
|
|
| **Backend** | 7 módulos, 30 entidades, 8 services | 18 módulos | 45% |
|
|
| **Frontend** | Estructura base | 18 módulos | 5% |
|
|
| **Documentación Técnica** | OpenAPI, ARCHITECTURE, CONTRIBUTING | API, Módulos, Arquitectura | 100% |
|
|
| **Documentación Funcional** | - | 449+ archivos MD | 100% |
|
|
|
|
---
|
|
|
|
## 🗄️ BASE DE DATOS
|
|
|
|
### Schemas Implementados (DDL)
|
|
| Schema | Tablas | ENUMs | Archivo DDL |
|
|
|--------|--------|-------|-------------|
|
|
| `construction` | 24 | 7 | `01-construction-schema-ddl.sql` |
|
|
| `hr` | 8 | - | `02-hr-schema-ddl.sql` |
|
|
| `hse` | 58 | 67 | `03-hse-schema-ddl.sql` |
|
|
| `estimates` | 8 | 4 | `04-estimates-schema-ddl.sql` |
|
|
| `infonavit` | 8 | - | `05-infonavit-schema-ddl.sql` |
|
|
| `inventory` | 4 | - | `06-inventory-ext-schema-ddl.sql` |
|
|
| `purchase` | 5 | - | `07-purchase-ext-schema-ddl.sql` |
|
|
| **Total** | **110** | **78** | |
|
|
|
|
### DDL Completo
|
|
Todos los schemas han sido implementados con:
|
|
- RLS (Row Level Security) para multi-tenancy
|
|
- Indices optimizados
|
|
- Funciones auxiliares (ej: `calculate_estimate_totals`)
|
|
|
|
---
|
|
|
|
## 💻 BACKEND
|
|
|
|
### Módulos con Código
|
|
```
|
|
backend/src/modules/
|
|
├── auth/ ✅ Autenticación JWT completa
|
|
│ ├── services/auth.service.ts
|
|
│ ├── middleware/auth.middleware.ts
|
|
│ └── dto/auth.dto.ts
|
|
├── budgets/ ✅ Presupuestos (MAI-003)
|
|
│ ├── entities/concepto.entity.ts
|
|
│ ├── entities/presupuesto.entity.ts
|
|
│ ├── entities/presupuesto-partida.entity.ts
|
|
│ ├── services/concepto.service.ts
|
|
│ └── services/presupuesto.service.ts
|
|
├── progress/ ✅ Control de Obra (MAI-005)
|
|
│ ├── entities/avance-obra.entity.ts
|
|
│ ├── entities/foto-avance.entity.ts
|
|
│ ├── entities/bitacora-obra.entity.ts
|
|
│ ├── entities/programa-obra.entity.ts
|
|
│ ├── entities/programa-actividad.entity.ts
|
|
│ ├── services/avance-obra.service.ts
|
|
│ └── services/bitacora-obra.service.ts
|
|
├── estimates/ ✅ Estimaciones (MAI-008)
|
|
│ ├── entities/estimacion.entity.ts
|
|
│ ├── entities/estimacion-concepto.entity.ts
|
|
│ ├── entities/generador.entity.ts
|
|
│ ├── entities/anticipo.entity.ts
|
|
│ ├── entities/amortizacion.entity.ts
|
|
│ ├── entities/retencion.entity.ts
|
|
│ ├── entities/fondo-garantia.entity.ts
|
|
│ ├── entities/estimacion-workflow.entity.ts
|
|
│ └── services/estimacion.service.ts
|
|
├── construction/ ✅ Proyectos (MAI-002)
|
|
│ ├── entities/proyecto.entity.ts
|
|
│ └── entities/fraccionamiento.entity.ts
|
|
├── hr/ ✅ RRHH (MAI-007)
|
|
│ ├── entities/employee.entity.ts
|
|
│ ├── entities/puesto.entity.ts
|
|
│ └── entities/employee-fraccionamiento.entity.ts
|
|
├── hse/ ✅ HSE (MAA-017)
|
|
│ ├── entities/incidente.entity.ts
|
|
│ ├── entities/incidente-involucrado.entity.ts
|
|
│ ├── entities/incidente-accion.entity.ts
|
|
│ └── entities/capacitacion.entity.ts
|
|
├── core/ ✅ Base multi-tenant
|
|
│ ├── entities/user.entity.ts
|
|
│ └── entities/tenant.entity.ts
|
|
└── shared/ ✅ Servicios compartidos
|
|
└── services/base.service.ts
|
|
```
|
|
|
|
### Pendientes
|
|
- Controllers REST para módulos nuevos
|
|
- 8 módulos MAI sin código backend
|
|
- 3 módulos MAE sin código backend
|
|
- Frontend integración con API
|
|
|
|
---
|
|
|
|
## 📋 MÓDULOS (18 Total)
|
|
|
|
### Fase 1 - MAI (14 módulos)
|
|
| Código | Nombre | DDL | Backend | Docs |
|
|
|--------|--------|:---:|:-------:|:----:|
|
|
| MAI-001 | Fundamentos | - | ✅ | ✅ |
|
|
| MAI-002 | Proyectos y Estructura | ✅ | ✅ | ✅ |
|
|
| MAI-003 | Presupuestos y Costos | ✅ | ✅ | ✅ |
|
|
| MAI-004 | Compras e Inventarios | ✅ | ⏳ | ✅ |
|
|
| MAI-005 | Control de Obra | ✅ | ✅ | ✅ |
|
|
| MAI-006 | Reportes y Analytics | - | ❌ | ✅ |
|
|
| MAI-007 | RRHH y Asistencias | ✅ | ✅ | ✅ |
|
|
| MAI-008 | Estimaciones | ✅ | ✅ | ✅ |
|
|
| MAI-009 | Calidad y Postventa | ✅ | ⏳ | ✅ |
|
|
| MAI-010 | CRM Derechohabientes | ⏳ | ❌ | ✅ |
|
|
| MAI-011 | INFONAVIT | ✅ | ⏳ | ✅ |
|
|
| MAI-012 | Contratos | ✅ | ⏳ | ✅ |
|
|
| MAI-013 | Administración | - | ❌ | ✅ |
|
|
| MAI-018 | Preconstrucción | ⏳ | ❌ | ✅ |
|
|
|
|
### Fase 2 - MAE (3 módulos)
|
|
| Código | Nombre | DDL | Backend | Docs |
|
|
|--------|--------|:---:|:-------:|:----:|
|
|
| MAE-014 | Finanzas y Controlling | ⏳ | ❌ | ✅ |
|
|
| MAE-015 | Activos y Maquinaria | ⏳ | ❌ | ✅ |
|
|
| MAE-016 | Gestión Documental | ⏳ | ❌ | ✅ |
|
|
|
|
### Fase 3 - MAA (1 módulo)
|
|
| Código | Nombre | DDL | Backend | Docs |
|
|
|--------|--------|:---:|:-------:|:----:|
|
|
| MAA-017 | Seguridad HSE | ✅ | ✅ | ✅ |
|
|
|
|
**Leyenda:** ✅ Implementado | ⏳ En progreso | ❌ No iniciado | - No aplica
|
|
|
|
---
|
|
|
|
## 🎯 PRÓXIMOS PASOS
|
|
|
|
### Inmediato
|
|
1. ✅ ~~Implementar DDL de `estimates` schema~~ - COMPLETADO
|
|
2. ✅ ~~Implementar DDL de `infonavit` schema~~ - COMPLETADO
|
|
3. ✅ ~~Backend MAI-003 Presupuestos~~ - COMPLETADO
|
|
4. ✅ ~~Backend MAI-005 Control de Obra~~ - COMPLETADO
|
|
5. ✅ ~~Backend MAI-008 Estimaciones~~ - COMPLETADO
|
|
6. ✅ ~~Módulo Auth JWT completo~~ - COMPLETADO
|
|
|
|
### Corto Plazo
|
|
1. Crear Controllers REST para módulos nuevos
|
|
2. Implementar backend de MAI-009 (Calidad y Postventa)
|
|
3. Implementar backend de MAI-011 (INFONAVIT)
|
|
4. Implementar backend de MAI-012 (Contratos)
|
|
5. Testing de módulos existentes
|
|
|
|
### Mediano Plazo
|
|
6. Frontend: Integración con API
|
|
7. Frontend: Módulos de Presupuestos y Estimaciones
|
|
8. Implementar Curva S y reportes de avance
|
|
|
|
---
|
|
|
|
## 📁 ARCHIVOS CLAVE
|
|
|
|
### Codigo
|
|
- **DDL:** `database/schemas/*.sql`
|
|
- **Backend:** `backend/src/modules/`
|
|
- **Services:** `backend/src/shared/services/base.service.ts`
|
|
- **Auth:** `backend/src/modules/auth/`
|
|
- **Constants SSOT:** `backend/src/shared/constants/`
|
|
|
|
### Documentacion Tecnica
|
|
- **Arquitectura:** `docs/ARCHITECTURE.md`
|
|
- **Contribucion:** `CONTRIBUTING.md`
|
|
- **API OpenAPI:** `docs/api/openapi.yaml`
|
|
- **API Reference:** `docs/backend/API-REFERENCE.md`
|
|
- **Modulos Backend:** `docs/backend/MODULES.md`
|
|
|
|
### Documentacion Funcional
|
|
- **Modulos:** `docs/02-definicion-modulos/`
|
|
- **Vision General:** `docs/00-vision-general/`
|
|
- **Arquitectura SaaS:** `docs/00-vision-general/ARQUITECTURA-SAAS.md`
|
|
- **Mapa DB:** `database/_MAP.md`
|
|
|
|
---
|
|
|
|
## 📈 MÉTRICAS
|
|
|
|
| Métrica | Valor |
|
|
|---------|-------|
|
|
| Archivos MD Funcionales | 449+ |
|
|
| Archivos MD Tecnicos | 5 (ARCHITECTURE, CONTRIBUTING, API-REF, MODULES, openapi) |
|
|
| Requerimientos (RF) | 87 |
|
|
| Especificaciones (ET) | 78 |
|
|
| User Stories | 149 |
|
|
| Story Points | 692 |
|
|
| ADRs | 12 |
|
|
| Entidades TypeORM | 30 |
|
|
| Services Backend | 8 |
|
|
| Tablas DDL | 110 |
|
|
| Endpoints API Documentados | 35+ |
|
|
|
|
---
|
|
|
|
**Última actualización:** 2025-12-12
|