sigo-entities 1.2.567 → 1.2.569
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -25
- package/REPORTE_ESTRUCTURA_2026-08-31.md +215 -215
- package/__tests__/datos-transportista.test.mjs +34 -0
- package/__tests__/precio-contratista-mo-colombia9612.test.mjs +56 -0
- package/dist/index.d.mts +63 -1
- package/dist/index.d.ts +63 -1
- package/dist/index.js +20153 -19950
- package/dist/index.mjs +14635 -14440
- package/package.json +2 -2
- package/.claude/CLAUDE.md +0 -70
- package/.claude/settings.json +0 -21
- package/.claude/skills/mdl-administracion/SKILL.md +0 -60
- package/.claude/skills/mdl-configuracion/SKILL.md +0 -49
- package/.claude/skills/ope-im/SKILL.md +0 -71
- package/.claude/skills/ope-logistica/SKILL.md +0 -60
- package/.claude/skills/ope-pex/SKILL.md +0 -106
- package/.claude/skills/shared-dtos/SKILL.md +0 -76
- package/__tests__/altasNvtReapertura.test.mjs +0 -58
- package/__tests__/asistenciaCuadrilla.test.mjs +0 -67
- package/__tests__/mongoJsonSchema.test.mjs +0 -66
- package/__tests__/replanteo.test.mjs +0 -44
package/README.md
CHANGED
|
@@ -10,28 +10,28 @@ npm logout
|
|
|
10
10
|
|
|
11
11
|
# Verificar usuario
|
|
12
12
|
npm whoami
|
|
13
|
-
|
|
14
|
-
## Publicar una nueva versión (`npm run release`)
|
|
15
|
-
Publica `sigo-entities` en npm y sube el commit a `origin/main`. Requiere estar en la rama `main` y con sesión iniciada en npm (`npm whoami`).
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
# Commit: "chore: versión X"
|
|
19
|
-
npm run release
|
|
20
|
-
|
|
21
|
-
# Commit: "feat: nuevo DTO y versión X"
|
|
22
|
-
npm run release -- "feat: nuevo DTO"
|
|
23
|
-
|
|
24
|
-
# Solo muestra qué haría, sin cambiar nada
|
|
25
|
-
npm run release -- --dry
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Pasos que ejecuta (`scripts/release.mjs`):
|
|
29
|
-
1. Verifica que la rama sea `main` y que haya sesión en npm.
|
|
30
|
-
2. `git pull --autostash` para bajar cambios.
|
|
31
|
-
3. Toma la última versión publicada (`npm view sigo-entities version`) y le sube el patch.
|
|
32
|
-
4. `npm version <nueva> --no-git-tag-version` y `npm run build`.
|
|
33
|
-
5. `git add -A` y commit (si no hay cambios, continúa sin commit).
|
|
34
|
-
6. `npm publish --ignore-scripts`.
|
|
35
|
-
7. `git push`.
|
|
36
|
-
|
|
37
|
-
Si algún paso falla, el release se detiene y muestra el error.
|
|
13
|
+
|
|
14
|
+
## Publicar una nueva versión (`npm run release`)
|
|
15
|
+
Publica `sigo-entities` en npm y sube el commit a `origin/main`. Requiere estar en la rama `main` y con sesión iniciada en npm (`npm whoami`).
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Commit: "chore: versión X"
|
|
19
|
+
npm run release
|
|
20
|
+
|
|
21
|
+
# Commit: "feat: nuevo DTO y versión X"
|
|
22
|
+
npm run release -- "feat: nuevo DTO"
|
|
23
|
+
|
|
24
|
+
# Solo muestra qué haría, sin cambiar nada
|
|
25
|
+
npm run release -- --dry
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Pasos que ejecuta (`scripts/release.mjs`):
|
|
29
|
+
1. Verifica que la rama sea `main` y que haya sesión en npm.
|
|
30
|
+
2. `git pull --autostash` para bajar cambios.
|
|
31
|
+
3. Toma la última versión publicada (`npm view sigo-entities version`) y le sube el patch.
|
|
32
|
+
4. `npm version <nueva> --no-git-tag-version` y `npm run build`.
|
|
33
|
+
5. `git add -A` y commit (si no hay cambios, continúa sin commit).
|
|
34
|
+
6. `npm publish --ignore-scripts`.
|
|
35
|
+
7. `git push`.
|
|
36
|
+
|
|
37
|
+
Si algún paso falla, el release se detiene y muestra el error.
|
|
@@ -1,215 +1,215 @@
|
|
|
1
|
-
# Reporte — Estructura de sigo-entities
|
|
2
|
-
|
|
3
|
-
**Fecha:** 2026-08-31
|
|
4
|
-
**Autor:** Brayan Andrés Valero Pinzón — Hermes Agent (sigo-frontend-dev)
|
|
5
|
-
**Destinatario:** Ingeniero Josue — Repositorio `sigo-entities`
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Resumen
|
|
10
|
-
|
|
11
|
-
Se detectaron **47 carpetas con nombres incorrectos** (sin guiones), **30 archivos `shared/index.ts` con Entity + DTO + `_id` mezclados**, y **3 carpetas en configuracion que ya fueron corregidas**.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## ✅ CORREGIDAS (3 archivos)
|
|
16
|
-
|
|
17
|
-
Las siguientes 3 Entities fueron corregidas siguiendo el patrón correcto:
|
|
18
|
-
|
|
19
|
-
| Carpeta | Archivos creados | Cambios |
|
|
20
|
-
|---|---|---|
|
|
21
|
-
| `theme config country` | `shared/theme-config-country-entity.ts` | Eliminado `_id`, DTOs inline en entity.ts, `shared/index.ts` solo exporta entity |
|
|
22
|
-
| `theme config user` | `shared/dto/favorito-dto.ts` + `shared/theme-config-user-entity.ts` | Eliminado `_id`, DTOs separados en carpeta `dto/`, `shared/index.ts` solo exporta entity |
|
|
23
|
-
| `scraping credential` | `shared/scraping-credential-entity.ts` | Eliminado `_id`, `shared/index.ts` solo exporta entity |
|
|
24
|
-
|
|
25
|
-
**Patrón aplicado:**
|
|
26
|
-
```
|
|
27
|
-
carpeta/
|
|
28
|
-
shared/
|
|
29
|
-
dto/
|
|
30
|
-
nombre-dto.ts ← DTOs aquí
|
|
31
|
-
nombre-entity.ts ← solo la Entity aquí
|
|
32
|
-
index.ts ← solo export * from './nombre-entity'
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## ❌ CARPETA 1: Carpetas con nombres SIN guiones (47 carpetas)
|
|
38
|
-
|
|
39
|
-
**Regla:** Nombres compuestos deben usar guiones (`-`) en lugar de espacios.
|
|
40
|
-
|
|
41
|
-
### Configuración (10 carpetas)
|
|
42
|
-
| Actual | Debería ser |
|
|
43
|
-
|---|---|
|
|
44
|
-
| `cargo personal` | `cargo-personal` |
|
|
45
|
-
| `contrato ot` | `contrato-ot` |
|
|
46
|
-
| `opcion sistema` | `opcion-sistema` |
|
|
47
|
-
| ~~`scraping credential`~~ | ~~`scraping-credential`~~ ✅ renombrada |
|
|
48
|
-
| ~~`theme config country`~~ | ~~`theme-config-country`~~ ✅ renombrada |
|
|
49
|
-
| ~~`theme config user`~~ | ~~`theme-config-user`~~ ✅ renombrada |
|
|
50
|
-
| `tipo clave` | `tipo-clave` |
|
|
51
|
-
| `tipo especialidad mo` | `tipo-especialidad-mo` |
|
|
52
|
-
| `tipo opcion sistema` | `tipo-opcion-sistema` |
|
|
53
|
-
| `usuarios autoinventario` | `usuarios-autoinventario` |
|
|
54
|
-
|
|
55
|
-
### Administración (8 carpetas)
|
|
56
|
-
| Actual | Debería ser |
|
|
57
|
-
|---|---|
|
|
58
|
-
| `chile 9512 paquetizado mano obra` | `chile-9512-paquetizado-mano-obra` |
|
|
59
|
-
| `chile 9512 paquetizado material` | `chile-9512-paquetizado-material` |
|
|
60
|
-
| `key integracion` | `key-integracion` |
|
|
61
|
-
| `mail structure` | `mail-structure` |
|
|
62
|
-
| `precio especialidad` | `precio-especialidad` |
|
|
63
|
-
| `precio material` | `precio-material` |
|
|
64
|
-
| `unidad obra material` | `unidad-obra-material` |
|
|
65
|
-
| `zona trabajo` | `zona-trabajo` |
|
|
66
|
-
|
|
67
|
-
### Logística (17 carpetas)
|
|
68
|
-
| Actual | Debería ser |
|
|
69
|
-
|---|---|
|
|
70
|
-
| `almacen extra` | `almacen-extra` |
|
|
71
|
-
| `atencion ordenes liquidadas` | `atencion-ordenes-liquidadas` |
|
|
72
|
-
| `consumo material` | `consumo-material` |
|
|
73
|
-
| `consumos P117` | `consumos-P117` |
|
|
74
|
-
| `devolucion almacen` | `devolucion-almacen` |
|
|
75
|
-
| `gran familia item` | `gran-familia-item` |
|
|
76
|
-
| `ingreso almacen` | `ingreso-almacen` |
|
|
77
|
-
| `movimiento almacen` | `movimiento-almacen` |
|
|
78
|
-
| `salida almacen` | `salida-almacen` |
|
|
79
|
-
| `stock almacen` | `stock-almacen` |
|
|
80
|
-
| `stock almacen equipos` | `stock-almacen-equipos` |
|
|
81
|
-
| `stock personal` | `stock-personal` |
|
|
82
|
-
| `stock personal equipos` | `stock-personal-equipos` |
|
|
83
|
-
| `tipo almacen` | `tipo-almacen` |
|
|
84
|
-
| `tipo movimiento almacen` | `tipo-movimiento-almacen` |
|
|
85
|
-
| `tipo stock` | `tipo-stock` |
|
|
86
|
-
| `transaccion folios` | `transaccion-folios` |
|
|
87
|
-
| `unidad medida` | `unidad--medida` |
|
|
88
|
-
|
|
89
|
-
### Programados (10 carpetas)
|
|
90
|
-
| Actual | Debería ser |
|
|
91
|
-
|---|---|
|
|
92
|
-
| `centro costos` | `centro-costos` |
|
|
93
|
-
| `mano obra global` | `mano-obra-global` |
|
|
94
|
-
| `rm actividad` | `rm-actividad` |
|
|
95
|
-
| `rm comuna` | `rm-comuna` |
|
|
96
|
-
| `rm mano obra` | `rm-mano-obra` |
|
|
97
|
-
| `rm paquetizado` | `rm-paquetizado` |
|
|
98
|
-
| `tipo actividad mo` | `tipo-actividad-mo` |
|
|
99
|
-
| `tipo obra` | `tipo-obra` |
|
|
100
|
-
| `model mo sql` | `model-mo-sql` |
|
|
101
|
-
| `model obra sql` | `model-obra-sql` |
|
|
102
|
-
|
|
103
|
-
### Operativa (7 carpetas)
|
|
104
|
-
| Actual | Debería ser |
|
|
105
|
-
|---|---|
|
|
106
|
-
| `order stock` | `order-stock` |
|
|
107
|
-
| `order stock store` | `order-stock-store` |
|
|
108
|
-
| `request number TTL` | `request-number-TTL` |
|
|
109
|
-
| `Tdc order stock` | `Tdc-order-stock` |
|
|
110
|
-
| `TOA Claro order stock` | `TOA-Claro-order-stock` |
|
|
111
|
-
| `TOA orden liquidacion` | `TOA-orden-liquidacion` |
|
|
112
|
-
| `TOA order stock` | `TOA-order-stock` |
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## ❌ CARPETA 2: `shared/index.ts` con Entity + DTO + `_id` mezclados (30 carpetas)
|
|
117
|
-
|
|
118
|
-
**Regla:** `shared/index.ts` debe contener SOLO la Entity. Los DTOs deben estar en `shared/dto/`.
|
|
119
|
-
|
|
120
|
-
### Configuración (3 carpetas — ya corregidas)
|
|
121
|
-
| Carpeta | Entity | DTOs presentes | `_id` | Estado |
|
|
122
|
-
|---|---|---|---|---|
|
|
123
|
-
| `configuracion/ theme-config-country/shared/index.ts` | `ThemeConfigCountryENTITY` | `ImgLogoNavBarDTO`, `ThemeCountryManualDTO` | ✅ Línea 50 | ✅ CORREGIDA (carpeta renombrada, DTOs en `shared/dto/`, `_id` eliminado) |
|
|
124
|
-
| `configuracion/ theme-config-user/shared/index.ts` | `ThemeConfigUserENTITY` | `FavoritoDTO` | ✅ Línea 33 | ✅ CORREGIDA (carpeta renombrada, DTOs en `shared/dto/`, `_id` eliminado) |
|
|
125
|
-
| `configuracion/ scraping-credential/shared/index.ts` | `ScrapingCredentialENTITY` | `CodigoNombreDTO` | ✅ Línea 10 | ✅ CORREGIDA (carpeta renombrada, `_id` eliminado) |
|
|
126
|
-
|
|
127
|
-
### Logística (2 carpetas)
|
|
128
|
-
| Carpeta | Entity | DTOs presentes | `_id` |
|
|
129
|
-
|---|---|---|---|
|
|
130
|
-
| `logistica/stock personal/shared/index.ts` | `StockPersonalENTITY` | Varios | ✅ |
|
|
131
|
-
| `logistica/stock personal equipos/shared/index.ts` | `StockPersonalEquiposENTITY` | Varios | ✅ |
|
|
132
|
-
|
|
133
|
-
### Operativa/Procesos (25 carpetas)
|
|
134
|
-
| Carpeta | Entity | `_id` |
|
|
135
|
-
|---|---|---|
|
|
136
|
-
| `operativa/procesos/altas_nvt_order/shared/index.ts` | `AltasNVTOrderENTITY` | ✅ Línea 35 |
|
|
137
|
-
| `operativa/procesos/bantel/shared/index.ts` | `BantelENTITY` | ❌ `resource_id` (equivalente a `_id`) |
|
|
138
|
-
| `operativa/procesos/claro_peru9112/shared/index.ts` | `Peru9112ClaroENTITY` | ✅ Línea 32 |
|
|
139
|
-
| `operativa/procesos/cliente_waoo/shared/index.ts` | `ClienteWAOOENTITY` | ❌ `line_id` (equivalente a `_id`) |
|
|
140
|
-
| `operativa/procesos/fibramas_order/shared/index.ts` | `Peru9112FibramasENTITY` | ❌ `resource_id` (equivalente a `_id`) |
|
|
141
|
-
| `operativa/procesos/fibramas_order_db/shared/index.ts` | `Peru9112FibramasENTITYDB` | ❌ `resource_id` (equivalente a `_id`) |
|
|
142
|
-
| `operativa/procesos/mifibra_db/shared/index.ts` | `MiFibraENTITYDB` | ❌ `resource_id` (equivalente a `_id`) |
|
|
143
|
-
| `operativa/procesos/order stock/shared/index.ts` | `OrderStockENTITY` | ✅ |
|
|
144
|
-
| `operativa/procesos/order stock store/shared/index.ts` | `OrderStockStoreENTITY` | ✅ |
|
|
145
|
-
| `operativa/procesos/request number TTL/shared/index.ts` | `RequestNumberTTLENTITY` | ✅ Línea 14 |
|
|
146
|
-
| `operativa/procesos/somacyl_order/shared/index.ts` | `SomacylOrderENTITY` | ✅ Línea 32 |
|
|
147
|
-
| `operativa/procesos/stb_dth_toaperu/shared/index.ts` | `STB_DTH_ToaENTITY` | ✅ |
|
|
148
|
-
| `operativa/procesos/Tdc order stock/shared/index.ts` | `TdcOrderStockENTITY` | ✅ |
|
|
149
|
-
| `operativa/procesos/TOA Claro order stock/shared/index.ts` | `TOAClaroOrderStockENTITY` | ✅ |
|
|
150
|
-
| `operativa/procesos/TOA orden liquidacion/shared/index.ts` | `TOAOrdenLiquidacionENTITY` | ✅ |
|
|
151
|
-
| `operativa/procesos/TOA orden liquidacion_db/shared/index.ts` | `TOAOrdenLiquidacionENTITYDB` | ✅ Línea 21 |
|
|
152
|
-
| `operativa/procesos/TOA order stock/shared/index.ts` | `TOAOrderStockENTITY` | ✅ |
|
|
153
|
-
| `operativa/procesos/toa_claro/shared/index.ts` | `ToaClaroENTITY` | ✅ |
|
|
154
|
-
| `operativa/procesos/toa_movistar/shared/index.ts` | `Peru9112TOAENTITY` | ✅ Línea 30 |
|
|
155
|
-
| `operativa/procesos/toa_movistar_db/shared/index.ts` | `Peru9112TOAENTITYDB` | ✅ Línea 27 |
|
|
156
|
-
| `operativa/procesos/tuves/shared/index.ts` | `TuvesENTITY` | ✅ Línea 30 |
|
|
157
|
-
| `operativa/procesos/tuves_order_stock/shared/index.ts` | `TuvesOrderStockENTITY` | ✅ |
|
|
158
|
-
| `operativa/procesos/win_order/shared/index.ts` | `Peru9112WinENTITY` | ❌ `resource_id` (equivalente a `_id`) |
|
|
159
|
-
| `operativa/procesos/win_order_db/shared/index.ts` | `Peru9112WinENTITYDB` | ❌ `resource_id` (equivalente a `_id`) |
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## ❌ CARPETA 3: Estructura incorrecta general
|
|
164
|
-
|
|
165
|
-
**Patrón actual incorrecto (la mayoría de carpetas):**
|
|
166
|
-
```
|
|
167
|
-
carpeta-con-espacios/
|
|
168
|
-
shared/
|
|
169
|
-
index.ts ← contiene: Entity + DTOs + _id todo mezclado
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
**Patrón correcto (patrón de referencia `navisionpreorden`):**
|
|
173
|
-
```
|
|
174
|
-
carpeta-con-guiones/
|
|
175
|
-
shared/
|
|
176
|
-
dto/
|
|
177
|
-
nombre-dto.ts
|
|
178
|
-
otro-dto.ts
|
|
179
|
-
nombre-entity.ts ← solo la Entity aquí
|
|
180
|
-
index.ts ← solo: export * from './nombre-entity'
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
## 📋 Resumen de problemas por prioridad
|
|
186
|
-
|
|
187
|
-
| Prioridad | Problema | Cantidad | Impacto |
|
|
188
|
-
|---|---|---|---|
|
|
189
|
-
| **P0** | `_id` en Entities | 23 carpetas | Error de validación MongoDB: `_id must be a string` |
|
|
190
|
-
| **P0** | Entity + DTOs mezclados en `shared/index.ts` | 30 carpetas | Confusión de imports, violación de separación de responsabilidades |
|
|
191
|
-
| **P1** | Nombres de carpetas con espacios (sin guiones) | 47 carpetas | Inconsistencia con patrón LatasOS, problemas de import en Windows |
|
|
192
|
-
| **P2** | `shared/index.ts` sin carpeta `dto/` separada | 30 carpetas | DTOs no reutilizables, archivo index.ts inflado |
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
## 📐 Patrón correcto de referencia
|
|
197
|
-
|
|
198
|
-
Archivo: `navisionpreorden/shared/navisionpreorden-entity.ts`
|
|
199
|
-
|
|
200
|
-
```typescript
|
|
201
|
-
// ✅ Sin _id
|
|
202
|
-
// ✅ Solo la Entity
|
|
203
|
-
// ✅ DTOs en carpeta shared/dto/
|
|
204
|
-
// ✅ Nombre de carpeta con guiones
|
|
205
|
-
// ✅ ID principal como número (ID_NavisionpreordenEntity)
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
## 🔧 Acciones requeridas
|
|
211
|
-
|
|
212
|
-
1. **P0 — Eliminar `_id`** de 20 carpetas restantes (incluyendo `resource_id` y `line_id` como equivalentes) — 3 ya corregidas: `theme-config-country`, `theme-config-user`, `scraping-credential`
|
|
213
|
-
2. **P0 — Separar DTOs de Entities** en 27 carpetas restantes — 3 ya corregidas: `theme-config-country`, `theme-config-user`, `scraping-credential`
|
|
214
|
-
3. **P1 — Renombrar carpetas** de 44 carpetas restantes — 3 ya corregidas: `theme-config-country`, `theme-config-user`, `scraping-credential`
|
|
215
|
-
4. **P2 — Actualizar `shared/index.ts`** en 27 carpetas restantes — 3 ya corregidas
|
|
1
|
+
# Reporte — Estructura de sigo-entities
|
|
2
|
+
|
|
3
|
+
**Fecha:** 2026-08-31
|
|
4
|
+
**Autor:** Brayan Andrés Valero Pinzón — Hermes Agent (sigo-frontend-dev)
|
|
5
|
+
**Destinatario:** Ingeniero Josue — Repositorio `sigo-entities`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Resumen
|
|
10
|
+
|
|
11
|
+
Se detectaron **47 carpetas con nombres incorrectos** (sin guiones), **30 archivos `shared/index.ts` con Entity + DTO + `_id` mezclados**, y **3 carpetas en configuracion que ya fueron corregidas**.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## ✅ CORREGIDAS (3 archivos)
|
|
16
|
+
|
|
17
|
+
Las siguientes 3 Entities fueron corregidas siguiendo el patrón correcto:
|
|
18
|
+
|
|
19
|
+
| Carpeta | Archivos creados | Cambios |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| `theme config country` | `shared/theme-config-country-entity.ts` | Eliminado `_id`, DTOs inline en entity.ts, `shared/index.ts` solo exporta entity |
|
|
22
|
+
| `theme config user` | `shared/dto/favorito-dto.ts` + `shared/theme-config-user-entity.ts` | Eliminado `_id`, DTOs separados en carpeta `dto/`, `shared/index.ts` solo exporta entity |
|
|
23
|
+
| `scraping credential` | `shared/scraping-credential-entity.ts` | Eliminado `_id`, `shared/index.ts` solo exporta entity |
|
|
24
|
+
|
|
25
|
+
**Patrón aplicado:**
|
|
26
|
+
```
|
|
27
|
+
carpeta/
|
|
28
|
+
shared/
|
|
29
|
+
dto/
|
|
30
|
+
nombre-dto.ts ← DTOs aquí
|
|
31
|
+
nombre-entity.ts ← solo la Entity aquí
|
|
32
|
+
index.ts ← solo export * from './nombre-entity'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## ❌ CARPETA 1: Carpetas con nombres SIN guiones (47 carpetas)
|
|
38
|
+
|
|
39
|
+
**Regla:** Nombres compuestos deben usar guiones (`-`) en lugar de espacios.
|
|
40
|
+
|
|
41
|
+
### Configuración (10 carpetas)
|
|
42
|
+
| Actual | Debería ser |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `cargo personal` | `cargo-personal` |
|
|
45
|
+
| `contrato ot` | `contrato-ot` |
|
|
46
|
+
| `opcion sistema` | `opcion-sistema` |
|
|
47
|
+
| ~~`scraping credential`~~ | ~~`scraping-credential`~~ ✅ renombrada |
|
|
48
|
+
| ~~`theme config country`~~ | ~~`theme-config-country`~~ ✅ renombrada |
|
|
49
|
+
| ~~`theme config user`~~ | ~~`theme-config-user`~~ ✅ renombrada |
|
|
50
|
+
| `tipo clave` | `tipo-clave` |
|
|
51
|
+
| `tipo especialidad mo` | `tipo-especialidad-mo` |
|
|
52
|
+
| `tipo opcion sistema` | `tipo-opcion-sistema` |
|
|
53
|
+
| `usuarios autoinventario` | `usuarios-autoinventario` |
|
|
54
|
+
|
|
55
|
+
### Administración (8 carpetas)
|
|
56
|
+
| Actual | Debería ser |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `chile 9512 paquetizado mano obra` | `chile-9512-paquetizado-mano-obra` |
|
|
59
|
+
| `chile 9512 paquetizado material` | `chile-9512-paquetizado-material` |
|
|
60
|
+
| `key integracion` | `key-integracion` |
|
|
61
|
+
| `mail structure` | `mail-structure` |
|
|
62
|
+
| `precio especialidad` | `precio-especialidad` |
|
|
63
|
+
| `precio material` | `precio-material` |
|
|
64
|
+
| `unidad obra material` | `unidad-obra-material` |
|
|
65
|
+
| `zona trabajo` | `zona-trabajo` |
|
|
66
|
+
|
|
67
|
+
### Logística (17 carpetas)
|
|
68
|
+
| Actual | Debería ser |
|
|
69
|
+
|---|---|
|
|
70
|
+
| `almacen extra` | `almacen-extra` |
|
|
71
|
+
| `atencion ordenes liquidadas` | `atencion-ordenes-liquidadas` |
|
|
72
|
+
| `consumo material` | `consumo-material` |
|
|
73
|
+
| `consumos P117` | `consumos-P117` |
|
|
74
|
+
| `devolucion almacen` | `devolucion-almacen` |
|
|
75
|
+
| `gran familia item` | `gran-familia-item` |
|
|
76
|
+
| `ingreso almacen` | `ingreso-almacen` |
|
|
77
|
+
| `movimiento almacen` | `movimiento-almacen` |
|
|
78
|
+
| `salida almacen` | `salida-almacen` |
|
|
79
|
+
| `stock almacen` | `stock-almacen` |
|
|
80
|
+
| `stock almacen equipos` | `stock-almacen-equipos` |
|
|
81
|
+
| `stock personal` | `stock-personal` |
|
|
82
|
+
| `stock personal equipos` | `stock-personal-equipos` |
|
|
83
|
+
| `tipo almacen` | `tipo-almacen` |
|
|
84
|
+
| `tipo movimiento almacen` | `tipo-movimiento-almacen` |
|
|
85
|
+
| `tipo stock` | `tipo-stock` |
|
|
86
|
+
| `transaccion folios` | `transaccion-folios` |
|
|
87
|
+
| `unidad medida` | `unidad--medida` |
|
|
88
|
+
|
|
89
|
+
### Programados (10 carpetas)
|
|
90
|
+
| Actual | Debería ser |
|
|
91
|
+
|---|---|
|
|
92
|
+
| `centro costos` | `centro-costos` |
|
|
93
|
+
| `mano obra global` | `mano-obra-global` |
|
|
94
|
+
| `rm actividad` | `rm-actividad` |
|
|
95
|
+
| `rm comuna` | `rm-comuna` |
|
|
96
|
+
| `rm mano obra` | `rm-mano-obra` |
|
|
97
|
+
| `rm paquetizado` | `rm-paquetizado` |
|
|
98
|
+
| `tipo actividad mo` | `tipo-actividad-mo` |
|
|
99
|
+
| `tipo obra` | `tipo-obra` |
|
|
100
|
+
| `model mo sql` | `model-mo-sql` |
|
|
101
|
+
| `model obra sql` | `model-obra-sql` |
|
|
102
|
+
|
|
103
|
+
### Operativa (7 carpetas)
|
|
104
|
+
| Actual | Debería ser |
|
|
105
|
+
|---|---|
|
|
106
|
+
| `order stock` | `order-stock` |
|
|
107
|
+
| `order stock store` | `order-stock-store` |
|
|
108
|
+
| `request number TTL` | `request-number-TTL` |
|
|
109
|
+
| `Tdc order stock` | `Tdc-order-stock` |
|
|
110
|
+
| `TOA Claro order stock` | `TOA-Claro-order-stock` |
|
|
111
|
+
| `TOA orden liquidacion` | `TOA-orden-liquidacion` |
|
|
112
|
+
| `TOA order stock` | `TOA-order-stock` |
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## ❌ CARPETA 2: `shared/index.ts` con Entity + DTO + `_id` mezclados (30 carpetas)
|
|
117
|
+
|
|
118
|
+
**Regla:** `shared/index.ts` debe contener SOLO la Entity. Los DTOs deben estar en `shared/dto/`.
|
|
119
|
+
|
|
120
|
+
### Configuración (3 carpetas — ya corregidas)
|
|
121
|
+
| Carpeta | Entity | DTOs presentes | `_id` | Estado |
|
|
122
|
+
|---|---|---|---|---|
|
|
123
|
+
| `configuracion/ theme-config-country/shared/index.ts` | `ThemeConfigCountryENTITY` | `ImgLogoNavBarDTO`, `ThemeCountryManualDTO` | ✅ Línea 50 | ✅ CORREGIDA (carpeta renombrada, DTOs en `shared/dto/`, `_id` eliminado) |
|
|
124
|
+
| `configuracion/ theme-config-user/shared/index.ts` | `ThemeConfigUserENTITY` | `FavoritoDTO` | ✅ Línea 33 | ✅ CORREGIDA (carpeta renombrada, DTOs en `shared/dto/`, `_id` eliminado) |
|
|
125
|
+
| `configuracion/ scraping-credential/shared/index.ts` | `ScrapingCredentialENTITY` | `CodigoNombreDTO` | ✅ Línea 10 | ✅ CORREGIDA (carpeta renombrada, `_id` eliminado) |
|
|
126
|
+
|
|
127
|
+
### Logística (2 carpetas)
|
|
128
|
+
| Carpeta | Entity | DTOs presentes | `_id` |
|
|
129
|
+
|---|---|---|---|
|
|
130
|
+
| `logistica/stock personal/shared/index.ts` | `StockPersonalENTITY` | Varios | ✅ |
|
|
131
|
+
| `logistica/stock personal equipos/shared/index.ts` | `StockPersonalEquiposENTITY` | Varios | ✅ |
|
|
132
|
+
|
|
133
|
+
### Operativa/Procesos (25 carpetas)
|
|
134
|
+
| Carpeta | Entity | `_id` |
|
|
135
|
+
|---|---|---|
|
|
136
|
+
| `operativa/procesos/altas_nvt_order/shared/index.ts` | `AltasNVTOrderENTITY` | ✅ Línea 35 |
|
|
137
|
+
| `operativa/procesos/bantel/shared/index.ts` | `BantelENTITY` | ❌ `resource_id` (equivalente a `_id`) |
|
|
138
|
+
| `operativa/procesos/claro_peru9112/shared/index.ts` | `Peru9112ClaroENTITY` | ✅ Línea 32 |
|
|
139
|
+
| `operativa/procesos/cliente_waoo/shared/index.ts` | `ClienteWAOOENTITY` | ❌ `line_id` (equivalente a `_id`) |
|
|
140
|
+
| `operativa/procesos/fibramas_order/shared/index.ts` | `Peru9112FibramasENTITY` | ❌ `resource_id` (equivalente a `_id`) |
|
|
141
|
+
| `operativa/procesos/fibramas_order_db/shared/index.ts` | `Peru9112FibramasENTITYDB` | ❌ `resource_id` (equivalente a `_id`) |
|
|
142
|
+
| `operativa/procesos/mifibra_db/shared/index.ts` | `MiFibraENTITYDB` | ❌ `resource_id` (equivalente a `_id`) |
|
|
143
|
+
| `operativa/procesos/order stock/shared/index.ts` | `OrderStockENTITY` | ✅ |
|
|
144
|
+
| `operativa/procesos/order stock store/shared/index.ts` | `OrderStockStoreENTITY` | ✅ |
|
|
145
|
+
| `operativa/procesos/request number TTL/shared/index.ts` | `RequestNumberTTLENTITY` | ✅ Línea 14 |
|
|
146
|
+
| `operativa/procesos/somacyl_order/shared/index.ts` | `SomacylOrderENTITY` | ✅ Línea 32 |
|
|
147
|
+
| `operativa/procesos/stb_dth_toaperu/shared/index.ts` | `STB_DTH_ToaENTITY` | ✅ |
|
|
148
|
+
| `operativa/procesos/Tdc order stock/shared/index.ts` | `TdcOrderStockENTITY` | ✅ |
|
|
149
|
+
| `operativa/procesos/TOA Claro order stock/shared/index.ts` | `TOAClaroOrderStockENTITY` | ✅ |
|
|
150
|
+
| `operativa/procesos/TOA orden liquidacion/shared/index.ts` | `TOAOrdenLiquidacionENTITY` | ✅ |
|
|
151
|
+
| `operativa/procesos/TOA orden liquidacion_db/shared/index.ts` | `TOAOrdenLiquidacionENTITYDB` | ✅ Línea 21 |
|
|
152
|
+
| `operativa/procesos/TOA order stock/shared/index.ts` | `TOAOrderStockENTITY` | ✅ |
|
|
153
|
+
| `operativa/procesos/toa_claro/shared/index.ts` | `ToaClaroENTITY` | ✅ |
|
|
154
|
+
| `operativa/procesos/toa_movistar/shared/index.ts` | `Peru9112TOAENTITY` | ✅ Línea 30 |
|
|
155
|
+
| `operativa/procesos/toa_movistar_db/shared/index.ts` | `Peru9112TOAENTITYDB` | ✅ Línea 27 |
|
|
156
|
+
| `operativa/procesos/tuves/shared/index.ts` | `TuvesENTITY` | ✅ Línea 30 |
|
|
157
|
+
| `operativa/procesos/tuves_order_stock/shared/index.ts` | `TuvesOrderStockENTITY` | ✅ |
|
|
158
|
+
| `operativa/procesos/win_order/shared/index.ts` | `Peru9112WinENTITY` | ❌ `resource_id` (equivalente a `_id`) |
|
|
159
|
+
| `operativa/procesos/win_order_db/shared/index.ts` | `Peru9112WinENTITYDB` | ❌ `resource_id` (equivalente a `_id`) |
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## ❌ CARPETA 3: Estructura incorrecta general
|
|
164
|
+
|
|
165
|
+
**Patrón actual incorrecto (la mayoría de carpetas):**
|
|
166
|
+
```
|
|
167
|
+
carpeta-con-espacios/
|
|
168
|
+
shared/
|
|
169
|
+
index.ts ← contiene: Entity + DTOs + _id todo mezclado
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Patrón correcto (patrón de referencia `navisionpreorden`):**
|
|
173
|
+
```
|
|
174
|
+
carpeta-con-guiones/
|
|
175
|
+
shared/
|
|
176
|
+
dto/
|
|
177
|
+
nombre-dto.ts
|
|
178
|
+
otro-dto.ts
|
|
179
|
+
nombre-entity.ts ← solo la Entity aquí
|
|
180
|
+
index.ts ← solo: export * from './nombre-entity'
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## 📋 Resumen de problemas por prioridad
|
|
186
|
+
|
|
187
|
+
| Prioridad | Problema | Cantidad | Impacto |
|
|
188
|
+
|---|---|---|---|
|
|
189
|
+
| **P0** | `_id` en Entities | 23 carpetas | Error de validación MongoDB: `_id must be a string` |
|
|
190
|
+
| **P0** | Entity + DTOs mezclados en `shared/index.ts` | 30 carpetas | Confusión de imports, violación de separación de responsabilidades |
|
|
191
|
+
| **P1** | Nombres de carpetas con espacios (sin guiones) | 47 carpetas | Inconsistencia con patrón LatasOS, problemas de import en Windows |
|
|
192
|
+
| **P2** | `shared/index.ts` sin carpeta `dto/` separada | 30 carpetas | DTOs no reutilizables, archivo index.ts inflado |
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 📐 Patrón correcto de referencia
|
|
197
|
+
|
|
198
|
+
Archivo: `navisionpreorden/shared/navisionpreorden-entity.ts`
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
// ✅ Sin _id
|
|
202
|
+
// ✅ Solo la Entity
|
|
203
|
+
// ✅ DTOs en carpeta shared/dto/
|
|
204
|
+
// ✅ Nombre de carpeta con guiones
|
|
205
|
+
// ✅ ID principal como número (ID_NavisionpreordenEntity)
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 🔧 Acciones requeridas
|
|
211
|
+
|
|
212
|
+
1. **P0 — Eliminar `_id`** de 20 carpetas restantes (incluyendo `resource_id` y `line_id` como equivalentes) — 3 ya corregidas: `theme-config-country`, `theme-config-user`, `scraping-credential`
|
|
213
|
+
2. **P0 — Separar DTOs de Entities** en 27 carpetas restantes — 3 ya corregidas: `theme-config-country`, `theme-config-user`, `scraping-credential`
|
|
214
|
+
3. **P1 — Renombrar carpetas** de 44 carpetas restantes — 3 ya corregidas: `theme-config-country`, `theme-config-user`, `scraping-credential`
|
|
215
|
+
4. **P2 — Actualizar `shared/index.ts`** en 27 carpetas restantes — 3 ya corregidas
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Prueba sobre el build (dist): correr `npm run build` antes de `npm test`
|
|
2
|
+
import { test } from 'node:test'
|
|
3
|
+
import assert from 'node:assert/strict'
|
|
4
|
+
import 'reflect-metadata'
|
|
5
|
+
import { createRequire } from 'node:module'
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url)
|
|
8
|
+
const { DatosTransportistaDTO, validateAndFormatData } = require('../dist/index.js')
|
|
9
|
+
|
|
10
|
+
const transportistaViejo = {
|
|
11
|
+
Identificacion: '45879632',
|
|
12
|
+
Nombres: 'JUAN',
|
|
13
|
+
Apellidos: 'PEREZ',
|
|
14
|
+
PlacaVehiculo: 'ABC123',
|
|
15
|
+
Licencia: 'Q45879632',
|
|
16
|
+
RUCEmpresa: '20512345678',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
test('Documento viejo sin RazonSocialEmpresa pasa la validación', async () => {
|
|
20
|
+
const result = await validateAndFormatData(transportistaViejo, DatosTransportistaDTO)
|
|
21
|
+
assert.equal(result.Identificacion, '45879632')
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
test('RazonSocialEmpresa se guarda cuando viene', async () => {
|
|
25
|
+
const result = await validateAndFormatData({ ...transportistaViejo, RazonSocialEmpresa: 'TRANSPORTES SAC' }, DatosTransportistaDTO)
|
|
26
|
+
assert.equal(result.RazonSocialEmpresa, 'TRANSPORTES SAC')
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('RazonSocialEmpresa de más de 300 caracteres se rechaza', async () => {
|
|
30
|
+
await assert.rejects(
|
|
31
|
+
validateAndFormatData({ ...transportistaViejo, RazonSocialEmpresa: 'X'.repeat(301) }, DatosTransportistaDTO),
|
|
32
|
+
/RazonSocialEmpresa/
|
|
33
|
+
)
|
|
34
|
+
})
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Prueba sobre el build (dist): correr `npm run build` antes de `npm test`
|
|
2
|
+
import { test } from 'node:test'
|
|
3
|
+
import assert from 'node:assert/strict'
|
|
4
|
+
import 'reflect-metadata'
|
|
5
|
+
import { createRequire } from 'node:module'
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url)
|
|
8
|
+
const { PrecioContratistaMOCOLOMBIA9612ENTITY, validateAndFormatData } = require('../dist/index.js')
|
|
9
|
+
|
|
10
|
+
const contrato2026 = {
|
|
11
|
+
ID_ContratoOT: 10, Codigo: '71.1 -0453 -2026', Descripcion: 'COBRA INSTALACIONES - COLTEL', Sistema: 'SIGO',
|
|
12
|
+
Vigencia: { FechaInicio: new Date('2026-01-01'), FechaFin: new Date('2026-12-31') }, CheckPrecioMO: true,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const precioZona = () => ({
|
|
16
|
+
ID_PrecioContratistaMO: 1,
|
|
17
|
+
Pais: { Codigo: '480', Nombre: 'Colombia' },
|
|
18
|
+
Delegacion: { Codigo: '9612', Nombre: '9612' },
|
|
19
|
+
Moneda: 'COP', Simbolo: '$', Decimales: 2,
|
|
20
|
+
Empresa: { ID_Empresa: 25, Codigo: '900123456', RazonSocial: 'CONTRATISTA SAS', NombreComercial: 'CONTRATISTA', NumeroDocumentoIdentidad: '900123456' },
|
|
21
|
+
Estado: { ID_Estado: 1, Nombre: 'ACTIVO' },
|
|
22
|
+
ContratoOT: contrato2026,
|
|
23
|
+
ManoObraGlobal: [{ ID_ManoObraGlobal: 1, Codigo: 'MO001', Actividad: 'A', Alcance: 'Tendido', Precio: 1500.5, FechaRegistro: new Date(), TipoMO: [] }],
|
|
24
|
+
Vigencia: { Zona: 'BOGOTA NORTE', FechaInicio: new Date('2026-11-12'), FechaFin: null },
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
test('Moneda por defecto es COP, $ y 2 decimales', () => {
|
|
28
|
+
const precio = new PrecioContratistaMOCOLOMBIA9612ENTITY()
|
|
29
|
+
assert.deepEqual([precio.Moneda, precio.Simbolo, precio.Decimales], ['COP', '$', 2])
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
test('Precio por zona con vigencia abierta (FechaFin vacía = new Date(0)) pasa la validación', async () => {
|
|
33
|
+
const result = await validateAndFormatData(precioZona(), PrecioContratistaMOCOLOMBIA9612ENTITY)
|
|
34
|
+
assert.equal(result.Vigencia.Zona, 'BOGOTA NORTE')
|
|
35
|
+
assert.equal(result.Vigencia.FechaFin.getTime(), 0)
|
|
36
|
+
assert.equal(result.ContratoOT.Codigo, '71.1 -0453 -2026')
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test('Vigencia cerrada guarda la FechaFin', async () => {
|
|
40
|
+
const dto = precioZona()
|
|
41
|
+
dto.Vigencia.FechaFin = new Date('2026-12-31')
|
|
42
|
+
const result = await validateAndFormatData(dto, PrecioContratistaMOCOLOMBIA9612ENTITY)
|
|
43
|
+
assert.ok(result.Vigencia.FechaFin instanceof Date)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
test('Sin zona se rechaza', async () => {
|
|
47
|
+
const dto = precioZona()
|
|
48
|
+
dto.Vigencia.Zona = ''
|
|
49
|
+
await assert.rejects(validateAndFormatData(dto, PrecioContratistaMOCOLOMBIA9612ENTITY), /Zona/)
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
test('Sin contrato se rechaza', async () => {
|
|
53
|
+
const dto = precioZona()
|
|
54
|
+
delete dto.ContratoOT
|
|
55
|
+
await assert.rejects(validateAndFormatData(dto, PrecioContratistaMOCOLOMBIA9612ENTITY), /ContratoOT|ID_ContratoOT/)
|
|
56
|
+
})
|