mas info en historial multas y reportes
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user