diff --git a/server/controller/Prestamo/activos.js b/server/controller/Prestamo/activos.js index f5e2f47..63a42e6 100644 --- a/server/controller/Prestamo/activos.js +++ b/server/controller/Prestamo/activos.js @@ -14,6 +14,7 @@ const activos = async (body) => { const idModulo = validar.validarId(body.idModulo); const pagina = validar.validarNumero(body.pagina, true); const usuario = body.usuario ? validar.validarNumeroCuenta(body.usuario) : ''; + const idPrestamo = body.idPrestamo ? validar.validarId(body.idPrestamo) : ''; const numeroInventario = body.numeroInventario ? validar.validarAlfanumerico( body.numeroInventario, @@ -31,7 +32,7 @@ const activos = async (body) => { .then((res) => { if (!res) throw new Error('No existe este modulo.'); return Prestamo.findAndCountAll({ - where: { activo: true }, + where: { activo: true, idPrestamo: { [Op.like]: `%${idPrestamo}%` } }, include: [ { model: Equipo, diff --git a/server/controller/Prestamo/historial.js b/server/controller/Prestamo/historial.js index 93793ea..7f60b9e 100644 --- a/server/controller/Prestamo/historial.js +++ b/server/controller/Prestamo/historial.js @@ -14,6 +14,7 @@ const Usuario = require(`${dbPath}/Usuario`); const historial = async (body) => { const pagina = validar.validarNumero(body.pagina, true); const usuario = body.usuario ? validar.validarNumeroCuenta(body.usuario) : ''; + const idPrestamo = body.idPrestamo ? validar.validarId(body.idPrestamo) : ''; const numeroInventario = body.numeroInventario ? validar.validarAlfanumerico( body.numeroInventario, @@ -31,6 +32,7 @@ const historial = async (body) => { if (idModulo) whereCarrito.push({ idModulo }); return Prestamo.findAndCountAll({ where: { + idPrestamo: { [Op.like]: `%${idPrestamo}%` }, [Op.or]: [ { activo: true }, { [Op.and]: [{ activo: false }, { horaEntrega: { [Op.not]: null } }] },