corregido

This commit is contained in:
2022-02-05 22:28:11 -06:00
parent c535ecc28a
commit c9c388b6c6
4 changed files with 13 additions and 9 deletions
@@ -9,7 +9,7 @@ const cancelarOperador = async (body) => {
const idPrestamo = validarNumeroEntero(body.idPrestamo, 'id préstamo', true);
const idOperador = validarNumeroEntero(body.idOperador, 'id operador', true);
return Operador.findOne({ where: { idOperador: idOperador } })
return Operador.findOne({ where: { idOperador } })
.then((res) => {
if (!res) throw new Error('No existe este operador.');
return Prestamo.findOne({ where: { idPrestamo } });
@@ -27,7 +27,11 @@ const cancelarOperador = async (body) => {
})
.then(() =>
Prestamo.update(
{ activo: false, idOperador, canceladoOperador: true },
{
activo: false,
idOperadorRegreso: idOperador,
canceladoOperador: true,
},
{ where: { idPrestamo } }
)
)