utn-cli 2.1.40 → 2.1.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utn-cli",
3
- "version": "2.1.40",
3
+ "version": "2.1.42",
4
4
  "description": "Herramienta CLI unificada para la gestión de plantillas en SIGU.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -3,6 +3,7 @@ const Router = express.Router();
3
3
 
4
4
  const Miscelaneo = require('../servicios/Nucleo/Miscelaneas.js');
5
5
  const { moitoreo } = require('../servicios/Nucleo/Monitoreo.js');
6
+ const ManejadorDeErrores = require('../servicios/Nucleo/ManejadorDeErrores.js');
6
7
 
7
8
  // Router.post("/DescargarArchivo", async (solicitud, respuesta) => {
8
9
  // if (await Miscelaneo.validarIdentificadorAPI(solicitud.headers)) {
@@ -473,6 +473,23 @@ Router.get('/obtenerPersonasFuncionarias', async (solicitud, respuesta, next) =>
473
473
  }
474
474
  });
475
475
 
476
+ Router.get('/obtenerPersonas', async (solicitud, respuesta, next) => {
477
+ try {
478
+ if (await Miscelaneo.validarTokenV2(solicitud.headers.authorization) && await Miscelaneo.validarAccesoDelOrigen(solicitud)) {
479
+ try {
480
+ return respuesta.json({ body: await Miscelaneo.obtenerPersonas(), error: undefined });
481
+ } catch (error) {
482
+ const MensajeDeError = 'No fue posible obtener los datos de las personas funcionarias';
483
+ console.error(new ManejadorDeErrores(MensajeDeError, ManejadorDeErrores.obtenerNumeroDeLinea(), true, `Dirección IP: ${solicitud.ip}`));
484
+ return respuesta.status(500).json({ body: undefined, error: MensajeDeError });
485
+ }
486
+ }
487
+ return respuesta.status(401).json({ body: undefined, error: ManejadorDeErrores.mensajeDeError401() });
488
+ } catch (error) {
489
+ next(error);
490
+ }
491
+ });
492
+
476
493
  Router.get('/obtenerEnlaceDePortal', async (solicitud, respuesta, next) => {
477
494
  try {
478
495
  if (await Miscelaneo.validarTokenV2(solicitud.headers.authorization) && await Miscelaneo.validarAccesoDelOrigen(solicitud)) {
@@ -268,13 +268,14 @@ class Miscelaneo {
268
268
  try {
269
269
  const titulo = tarjeta['Título'];
270
270
  const existentes = await ejecutarConsultaSIGU(
271
- `SELECT CAST(JSON_VALUE(\`Datos\`, '$."Posición"') AS UNSIGNED) AS Posicion, JSON_VALUE(\`Datos\`, '$."Título"') AS Titulo, JSON_VALUE(\`Datos\`, '$."Descripción"') AS Descripcion FROM \`SIGU\`.\`SIGU_ModulosV2Tarjetas\` WHERE \`Modulo\` = ? AND JSON_VALUE(\`Datos\`, '$."Título"') = ?`,
271
+ `SELECT CAST(JSON_VALUE(\`Datos\`, '$."Posición"') AS UNSIGNED) AS Posicion, JSON_VALUE(\`Datos\`, '$."Título"') AS Titulo, JSON_VALUE(\`Datos\`, '$."Descripción"') AS Descripcion, \`Datos\` FROM \`SIGU\`.\`SIGU_ModulosV2Tarjetas\` WHERE \`Modulo\` = ? AND JSON_VALUE(\`Datos\`, '$."Título"') = ?`,
272
272
  [this.NombreCanonicoDelModulo, titulo]
273
273
  );
274
274
 
275
275
  let datosFinales;
276
276
  if (existentes.length > 0) {
277
- datosFinales = { ...tarjeta, 'Posición': existentes[0].Posicion, 'Título': existentes[0].Titulo, 'Descripción': existentes[0].Descripcion, 'Archivo': archivo };
277
+ const datosExistentes = typeof existentes[0].Datos === 'string' ? JSON.parse(existentes[0].Datos) : existentes[0].Datos;
278
+ datosFinales = { ...datosExistentes, ...tarjeta, 'Posición': existentes[0].Posicion, 'Título': existentes[0].Titulo, 'Descripción': existentes[0].Descripcion, 'Archivo': archivo };
278
279
  await ejecutarConsultaSIGU(
279
280
  `UPDATE \`SIGU\`.\`SIGU_ModulosV2Tarjetas\` SET \`Datos\` = ?, \`LastUser\` = 'Sistema' WHERE \`Modulo\` = ? AND JSON_VALUE(\`Datos\`, '$."Título"') = ?`,
280
281
  [JSON.stringify(datosFinales), this.NombreCanonicoDelModulo, titulo]
@@ -1181,6 +1182,12 @@ class Miscelaneo {
1181
1182
  );
1182
1183
  }
1183
1184
 
1185
+ async obtenerPersonas() {
1186
+ return await ejecutarConsultaSIGU("SELECT `Identificador`, `Identificacion`, `Nombre`, `PrimerApellido`,\
1187
+ `SegundoApellido` FROM `SIGU`.`SIGU_Personas` ORDER BY `Nombre`, `PrimerApellido`,\
1188
+ `SegundoApellido`");
1189
+ }
1190
+
1184
1191
  async obtenerPersonasFuncionarias() {
1185
1192
  return await ejecutarConsultaSIGU("SELECT `Identificador`, `Identificacion`, `Nombre`, `PrimerApellido`,\
1186
1193
  `SegundoApellido` FROM `SIGU`.`SIGU_Personas` WHERE `Identificador` IN\
@@ -2621,7 +2628,6 @@ class Miscelaneo {
2621
2628
  const config = configuracion.find(c => c.Titulo === t['Título']);
2622
2629
  if (config) {
2623
2630
  t['Posición'] = config.Posicion;
2624
- if (config.ColorDeBorde) t.ColorDeBorde = config.ColorDeBorde;
2625
2631
  }
2626
2632
  if (!t.ColorDeBorde && colorDelModulo) t.ColorDeBorde = colorDelModulo;
2627
2633
  const datos = datosPorTitulo[t['Título']];
@@ -7,12 +7,7 @@ import { MatIconModule } from '@angular/material/icon';
7
7
  import { MatTooltipModule } from '@angular/material/tooltip';
8
8
  import { MatDialog } from '@angular/material/dialog';
9
9
  import { MatDividerModule } from '@angular/material/divider';
10
- import { ReporteDeIncidenciasComponent } from '../../../Componentes/Nucleo/reporte-de-incidencias/reporte-de-incidencias.component';
11
- import { MensajesComponent } from '../../../Componentes/Nucleo/mensajes/mensajes.component';
12
- import { MensajeConfirmacionHTMLComponent } from '../../../Componentes/Nucleo/mensaje-confirmacion-html/mensaje-confirmacion-html';
13
- import { ReporteDeSugerenciasComponent } from '../../../Componentes/Nucleo/reporte-de-sugerencias/reporte-de-sugerencias.component';
14
- import { EstadisticasDelModuloComponent } from '../../../Componentes/Nucleo/estadisticas-del-modulo/estadisticas-del-modulo.component';
15
- import { ReordenarMenuComponent, ItemDeMenuDialog } from '../../../Componentes/Nucleo/reordenar-menu/reordenar-menu.component';
10
+ import type { ItemDeMenuDialog } from '../../../Componentes/Nucleo/reordenar-menu/reordenar-menu.component';
16
11
 
17
12
  import { MatMenuModule } from '@angular/material/menu';
18
13
 
@@ -112,13 +107,14 @@ export class ContenedorComponentesComponent implements OnInit, OnDestroy, AfterV
112
107
  });
113
108
  }
114
109
 
115
- abrirDialogReordenarMenu(): void {
110
+ async abrirDialogReordenarMenu(): Promise<void> {
116
111
  const itemsVisibles: ItemDeMenuDialog[] = this.itemsDeMenuVisibles.map(i => ({
117
112
  id: i.id,
118
113
  etiqueta: i.etiqueta,
119
114
  icono: i.icono
120
115
  }));
121
116
 
117
+ const { ReordenarMenuComponent } = await import('../../../Componentes/Nucleo/reordenar-menu/reordenar-menu.component');
122
118
  this.dialog.open(ReordenarMenuComponent, { data: { items: itemsVisibles } })
123
119
  .afterClosed()
124
120
  .subscribe((resultado: ItemDeMenuDialog[] | undefined) => {
@@ -174,7 +170,7 @@ export class ContenedorComponentesComponent implements OnInit, OnDestroy, AfterV
174
170
  }, 60000);
175
171
  });
176
172
 
177
- this.http.get(this.datosGlobalesService.ObtenerURL() + 'misc/inicializar').subscribe((datos: any) => {
173
+ this.http.get(this.datosGlobalesService.ObtenerURL() + 'misc/inicializar').subscribe(async (datos: any) => {
178
174
  const body = datos.body;
179
175
 
180
176
  this.TienePermiso = body.TienePermiso;
@@ -196,6 +192,8 @@ export class ContenedorComponentesComponent implements OnInit, OnDestroy, AfterV
196
192
  this.EnlaceDelVideo = body.EnlaceDelVideo;
197
193
  this.Mensajes = body.Notificaciones;
198
194
 
195
+ const { MensajeConfirmacionHTMLComponent } = await import('../../../Componentes/Nucleo/mensaje-confirmacion-html/mensaje-confirmacion-html');
196
+
199
197
  if (body.Consentimiento?.Aceptaciones === 0) {
200
198
  const ConsentimientoInformadoId = body.Consentimiento.Consentimiento[0].ConsentimientoInformadoId;
201
199
  this.dialog.open(MensajeConfirmacionHTMLComponent, {
@@ -260,10 +258,10 @@ export class ContenedorComponentesComponent implements OnInit, OnDestroy, AfterV
260
258
  }
261
259
 
262
260
  irAMensajes(): void {
263
- this.http.get(this.datosGlobalesService.ObtenerURL() + 'misc/obtenerNotificaciones').subscribe((datos: any) => {
264
- let data = datos.body;
265
- this.dialog.open(MensajesComponent, { data });
266
- })
261
+ this.http.get(this.datosGlobalesService.ObtenerURL() + 'misc/obtenerNotificaciones').subscribe(async (datos: any) => {
262
+ const { MensajesComponent } = await import('../../../Componentes/Nucleo/mensajes/mensajes.component');
263
+ this.dialog.open(MensajesComponent, { data: datos.body });
264
+ });
267
265
  }
268
266
 
269
267
  irAAyuda(): void {
@@ -282,7 +280,8 @@ export class ContenedorComponentesComponent implements OnInit, OnDestroy, AfterV
282
280
  window.open(this.EnlaceDelVideo, '_blank', 'noopener,noreferrer');
283
281
  }
284
282
 
285
- irASoporte(): void {
283
+ async irASoporte(): Promise<void> {
284
+ const { ReporteDeIncidenciasComponent } = await import('../../../Componentes/Nucleo/reporte-de-incidencias/reporte-de-incidencias.component');
286
285
  this.dialog.open(ReporteDeIncidenciasComponent);
287
286
  }
288
287
 
@@ -309,12 +308,14 @@ export class ContenedorComponentesComponent implements OnInit, OnDestroy, AfterV
309
308
  })
310
309
  }
311
310
 
312
- irASugerencias(): void {
311
+ async irASugerencias(): Promise<void> {
312
+ const { ReporteDeSugerenciasComponent } = await import('../../../Componentes/Nucleo/reporte-de-sugerencias/reporte-de-sugerencias.component');
313
313
  this.dialog.open(ReporteDeSugerenciasComponent);
314
314
  }
315
315
 
316
316
  irAEstadisticasDelModulo(): void {
317
- this.http.get(this.datosGlobalesService.ObtenerURL() + 'misc/obtenerVistas').subscribe((datos: any) => {
317
+ this.http.get(this.datosGlobalesService.ObtenerURL() + 'misc/obtenerVistas').subscribe(async (datos: any) => {
318
+ const { EstadisticasDelModuloComponent } = await import('../../../Componentes/Nucleo/estadisticas-del-modulo/estadisticas-del-modulo.component');
318
319
  this.dialog.open(EstadisticasDelModuloComponent, { data: datos.body });
319
320
  });
320
321
  }