restrincciones
This commit is contained in:
@@ -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'],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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 } }))
|
||||
|
||||
@@ -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.');
|
||||
|
||||
Reference in New Issue
Block a user