From 2f9ba8bbd1c1a133d72944ae0c519ec1649d29b1 Mon Sep 17 00:00:00 2001 From: Lemuel Marquez Date: Mon, 31 May 2021 20:27:35 -0500 Subject: [PATCH] error --- server/controller/Prestamo/regresarNumeroInventario.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/controller/Prestamo/regresarNumeroInventario.js b/server/controller/Prestamo/regresarNumeroInventario.js index 566f482..4ab19da 100644 --- a/server/controller/Prestamo/regresarNumeroInventario.js +++ b/server/controller/Prestamo/regresarNumeroInventario.js @@ -26,6 +26,8 @@ const regresarNumeroInventario = async (body) => { .then((res) => { if (!res) throw new Error('No existe un prestamo activo con este equipo.'); + if (!res.Equipo.enUso) + throw new Error('Aun no se ha entregado el equipo al usuario.'); idPrestamo = res.idPrestamo; return Equipo.update( { enUso: false, apartado: false },