From e0b660ab1b96820d229df84b24c957ad86d401fa Mon Sep 17 00:00:00 2001 From: lemuel Date: Thu, 2 Sep 2021 18:48:37 -0500 Subject: [PATCH] mas info en historial multas y reportes --- .../controller/Reporte/historialReportes.js | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/server/controller/Reporte/historialReportes.js b/server/controller/Reporte/historialReportes.js index 2ad2a10..0692575 100644 --- a/server/controller/Reporte/historialReportes.js +++ b/server/controller/Reporte/historialReportes.js @@ -3,6 +3,7 @@ const dbPath = '../../db/tablas'; const Reporte = require(`${dbPath}/Reporte`); const Operador = require(`${dbPath}/Operador`); const Prestamo = require(`${dbPath}/Prestamo`); +const Usuario = require(`${dbPath}/Usuario`); const historialReportes = async (body) => { const idEquipo = validar.validarId(body.idEquipo); @@ -10,7 +11,16 @@ const historialReportes = async (body) => { return Reporte.findAndCountAll({ where: { idEquipo }, - include: [{ model: Prestamo }, { model: Operador }], + include: [ + { + model: Prestamo, + include: [ + { model: Usuario }, + { model: Operador, as: 'OperadorRegreso' }, + ], + }, + { model: Operador }, + ], limit: 25, offset: 25 * (pagina - 1), order: [['createdAt', 'DESC']], @@ -24,6 +34,16 @@ const historialReportes = async (body) => { delete res.rows[i].dataValues.Prestamo.dataValues.idOperadorRegreso; delete res.rows[i].dataValues.Prestamo.dataValues.idUsuario; delete res.rows[i].dataValues.Prestamo.dataValues.idEquipo; + delete res.rows[i].dataValues.Prestamo.dataValues.Usuario.dataValues + .password; + delete res.rows[i].dataValues.Prestamo.dataValues.Usuario.dataValues + .idCarrera; + delete res.rows[i].dataValues.Prestamo.dataValues.Usuario.dataValues + .idTipoUsuario; + delete res.rows[i].dataValues.Prestamo.dataValues.OperadorRegreso + .dataValues.idTipoUsuario; + delete res.rows[i].dataValues.Prestamo.dataValues.OperadorRegreso + .dataValues.password; delete res.rows[i].dataValues.Operador; } if (res.rows[i].dataValues.Operador) {