horas finales

This commit is contained in:
2022-02-14 19:19:51 -06:00
parent de1bb72c20
commit e27646fc0f
2 changed files with 9 additions and 11 deletions
+8 -10
View File
@@ -18,6 +18,10 @@ const entregar = async (body) => {
true
);
let idEquipo;
let update = {
idOperadorEntrega,
horaInicio: ahora.format(),
};
return Operador.findOne({ where: { idOperador: idOperadorEntrega } })
.then((res) => {
@@ -44,18 +48,12 @@ 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.horaInicio = ahora.add(2, 'h').format();
return Equipo.update({ idStatus: 2 }, { where: { idEquipo } });
})
.then(() => {
Prestamo.update(
{
idOperadorEntrega,
horaInicio: ahora.format(),
horaFin: ahora.add(2, 'h').format(),
},
{ where: { idPrestamo } }
);
})
.then(() => Prestamo.update(update, { where: { idPrestamo } }))
.then(() =>
Equipo.findOne({
where: { idEquipo },
+1 -1
View File
@@ -13,7 +13,7 @@ const Usuario = require(`${dbPath}/Usuario`);
const pedir = async (body) => {
const ahora = moment();
const horaMax = moment(`${ahora.format('YYYY-MM-DD')} 19:00`);
const horaMax = moment(`${ahora.format('YYYY-MM-DD')} 18:45`);
const horaMin = moment(`${ahora.format('YYYY-MM-DD')} 09:00`);
const idUsuario = validarNumeroEntero(body.idUsuario, 'id usuario', true);
const idTipoCarrito = validarNumeroEntero(