id prestamo como filtro
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 } }] },
|
||||
|
||||
Reference in New Issue
Block a user