cambios en db y endpoints de get prestamo y pedir listos
This commit is contained in:
@@ -41,10 +41,7 @@ const pedir = async (body) => {
|
||||
throw new Error(
|
||||
'Este usuario tiene una multa activa, no puede solicitar un equipo de computo.'
|
||||
);
|
||||
return Prestamo.findOne({
|
||||
where: { idUsuario },
|
||||
include: [{ model: Equipo, where: { activo: true } }],
|
||||
});
|
||||
return Prestamo.findOne({ where: { idUsuario, activo: true } });
|
||||
})
|
||||
.then((res) => {
|
||||
if (res)
|
||||
@@ -53,7 +50,7 @@ const pedir = async (body) => {
|
||||
);
|
||||
return Equipo.findOne({
|
||||
where: {
|
||||
activo: false,
|
||||
apartado: false,
|
||||
idStatus: 1,
|
||||
idPrograma: idPrograma ? idPrograma : null,
|
||||
},
|
||||
@@ -75,7 +72,7 @@ const pedir = async (body) => {
|
||||
'No hay un equipo de computo con las características solicitadas disponible. Intenta más tarde o con otras características.'
|
||||
);
|
||||
idEquipo = res.idEquipo;
|
||||
return Equipo.update({ activo: true }, { where: { idEquipo } });
|
||||
return Equipo.update({ apartado: true }, { where: { idEquipo } });
|
||||
})
|
||||
.then((res) =>
|
||||
Prestamo.create({
|
||||
|
||||
Reference in New Issue
Block a user