id prestamo como filtro

This commit is contained in:
xXpuma99Xx
2021-09-17 00:32:14 -05:00
parent c7240b8b1f
commit b514f8352a
2 changed files with 4 additions and 1 deletions
+2 -1
View File
@@ -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,
+2
View File
@@ -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 } }] },