attributes específicos

This commit is contained in:
xXpuma99Xx
2022-01-20 22:01:14 -06:00
parent 8d302d43b0
commit b1970fe4a5
23 changed files with 1210 additions and 1358 deletions
@@ -24,28 +24,28 @@ const historialMultasEquipo = async (body) => {
{
model: Prestamo,
where: { idEquipo },
attributes: [
'idPrestamo',
'activo',
'horaMaxRecoger',
'horaInicio',
'horaFin',
'horaEntrega',
'canceladoUsuario',
'createdAt',
],
},
{
model: Operador,
as: 'OperadorMulta',
attributes: ['idOperador', 'operador'],
},
{ model: Operador, as: 'OperadorMulta' },
],
attributes: ['idMulta', 'descripcion', 'fechaFin', 'createdAt'],
limit: 25,
offset: 25 * (pagina - 1),
order: [['createdAt', 'DESC']],
}).then((res) => {
for (let i = 0; i < res.rows.length; i++) {
delete res.rows[i].dataValues.idInfraccion;
delete res.rows[i].dataValues.idPrestamo;
delete res.rows[i].dataValues.idOperadorMulta;
delete res.rows[i].dataValues.OperadorMulta.dataValues.password;
delete res.rows[i].dataValues.OperadorMulta.dataValues.idTipoUsuario;
delete res.rows[i].dataValues.OperadorMulta.dataValues.activo;
delete res.rows[i].dataValues.Prestamo.dataValues.idOperadorEntrega;
delete res.rows[i].dataValues.Prestamo.dataValues.idOperadorRegreso;
delete res.rows[i].dataValues.Prestamo.dataValues.idOperadorCancelacion;
delete res.rows[i].dataValues.Prestamo.dataValues.idUsuario;
delete res.rows[i].dataValues.Prestamo.dataValues.idEquipo;
}
return { count: res.count, historialMultasEquipo: res.rows };
});
}).then((res) => ({ count: res.count, historialMultasEquipo: res.rows }));
};
module.exports = historialMultasEquipo;
@@ -36,43 +36,40 @@ const historialMultasUsuario = async (body) => {
{
model: Carrito,
include: [{ model: Modulo }, { model: TipoCarrito }],
attributes: ['idCarrito', 'sobrenombre'],
},
],
attributes: [
'idEquipo',
'numeroSerie',
'numeroInventario',
'sobrenombre',
],
},
],
attributes: [
'idPrestamo',
'activo',
'horaMaxRecoger',
'horaInicio',
'horaFin',
'horaEntrega',
'canceladoUsuario',
'createdAt',
],
},
{ model: Infraccion },
{ model: Operador, as: 'OperadorMulta' },
{
model: Operador,
as: 'OperadorMulta',
attributes: ['idOperador', 'operador'],
},
],
attributes: ['idMulta', 'descripcion', 'fechaFin', 'createdAt'],
limit: 25,
offset: 25 * (pagina - 1),
order: [['createdAt', 'DESC']],
}).then((res) => {
for (let i = 0; i < res.rows.length; i++) {
delete res.rows[i].dataValues.idInfraccion;
delete res.rows[i].dataValues.idPrestamo;
delete res.rows[i].dataValues.idOperadorMulta;
delete res.rows[i].dataValues.OperadorMulta.dataValues.password;
delete res.rows[i].dataValues.OperadorMulta.dataValues.idTipoUsuario;
delete res.rows[i].dataValues.OperadorMulta.dataValues.activo;
delete res.rows[i].dataValues.Prestamo.dataValues.idOperadorEntrega;
delete res.rows[i].dataValues.Prestamo.dataValues.idOperadorRegreso;
delete res.rows[i].dataValues.Prestamo.dataValues.idOperadorCancelacion;
delete res.rows[i].dataValues.Prestamo.dataValues.idUsuario;
delete res.rows[i].dataValues.Prestamo.dataValues.idEquipo;
delete res.rows[i].dataValues.Prestamo.dataValues.Equipo.dataValues
.idCarrito;
delete res.rows[i].dataValues.Prestamo.dataValues.Equipo.dataValues
.idStatus;
delete res.rows[i].dataValues.Prestamo.dataValues.Equipo.dataValues
.idPrograma;
delete res.rows[i].dataValues.Prestamo.dataValues.Equipo.dataValues
.Carrito.dataValues.idTipoCarrito;
delete res.rows[i].dataValues.Prestamo.dataValues.Equipo.dataValues
.Carrito.dataValues.idModulo;
}
return { count: res.count, historialMultasUsuario: res.rows };
});
}).then((res) => ({ count: res.count, historialMultasUsuario: res.rows }));
};
module.exports = historialMultasUsuario;