utn-cli 2.1.41 → 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
|
@@ -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
|
-
|
|
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']];
|