restrincciones

This commit is contained in:
xXpuma99Xx
2022-02-20 23:53:10 -06:00
parent 9c321c622f
commit ee27a9db64
4 changed files with 11 additions and 31 deletions
@@ -18,24 +18,6 @@ const historialMultasUsuario = async (body) => {
{
model: Prestamo,
where: { idUsuario },
// include: [
// {
// model: Equipo,
// include: [
// {
// model: Carrito,
// include: [{ model: Modulo }, { model: TipoCarrito }],
// attributes: ['idCarrito', 'carrito'],
// },
// ],
// attributes: [
// 'idEquipo',
// 'numeroSerie',
// 'numeroInventario',
// 'equipo',
// ],
// },
// ],
attributes: ['idPrestamo'],
},
{
-1
View File
@@ -42,7 +42,6 @@ const multar = async (body) => {
})
.then((res) => {
if (!res) throw new Error('No existe esta infracción.');
// Checar si tiene una multa activa, agragar días a multa
gravedad = res.gravedad;
return Prestamo.findOne({
where: { idPrestamo },
+3 -4
View File
@@ -50,10 +50,9 @@ const entregar = async (body) => {
'Ya pasó el tiempo límite para recoger el equipo de cómputo.'
);
});
// if (ahora > moment(`${ahora.format('YYYY-MM-DD')} 17:45`))
// update.horaFin = moment(`${ahora.format('YYYY-MM-DD')} 19:45`);
// else update.horaFin = ahora.add(2, 'h').format();
update.horaFin = ahora.add(2, 'h').format();
if (ahora > moment(`${ahora.format('YYYY-MM-DD')} 17:45`))
update.horaFin = moment(`${ahora.format('YYYY-MM-DD')} 19:45`);
else update.horaFin = ahora.add(2, 'h').format();
return Equipo.update({ idStatus: 2 }, { where: { idEquipo } });
})
.then(() => Prestamo.update(update, { where: { idPrestamo } }))
+8 -8
View File
@@ -30,14 +30,14 @@ const pedir = async (body) => {
let whereEquipo = { idStatus: 4 };
let idEquipo;
// if (ahora.day() === 6 || ahora.day() === 0)
// throw new Error(
// 'No se puede pedir un equipo de cómputo los días sabados y domingos.'
// );
// if (ahora > horaMax)
// throw new Error('Ya no se puede realizar un préstamo el día de hoy.');
// if (ahora < horaMin)
// throw new Error('Aún es muy temprano para realizar un préstamo.');
if (ahora.day() === 6 || ahora.day() === 0)
throw new Error(
'No se puede pedir un equipo de cómputo los días sabados y domingos.'
);
if (ahora > horaMax)
throw new Error('Ya no se puede realizar un préstamo el día de hoy.');
if (ahora < horaMin)
throw new Error('Aún es muy temprano para realizar un préstamo.');
return TipoCarrito.findOne({ where: { idTipoCarrito } })
.then((res) => {
if (!res) throw new Error('No existe este tipo de equipo.');