entrega inmediata
This commit is contained in:
@@ -27,12 +27,8 @@ const cancelarOperador = async (body) => {
|
||||
throw new Error(
|
||||
'Este prestamo ya no esta activo, ya no se puede cancelar.'
|
||||
);
|
||||
// if (res.Equipo.idStatus === 2)
|
||||
// throw new Error(
|
||||
// 'El equipo ya fue entregado al usuario, ya no se puede cancelar.'
|
||||
// );
|
||||
return Equipo.update(
|
||||
{ idStatus: 3 },
|
||||
{ idStatus: 4 },
|
||||
{ where: { idEquipo: res.Equipo.idEquipo } }
|
||||
);
|
||||
})
|
||||
|
||||
@@ -22,7 +22,7 @@ const cancelarUsuario = async (body) => {
|
||||
'El equipo ya fue entregado al usuario, ya no se puede cancelar.'
|
||||
);
|
||||
return Equipo.update(
|
||||
{ idStatus: 3 },
|
||||
{ idStatus: 4 },
|
||||
{ where: { idEquipo: res.Equipo.idEquipo } }
|
||||
);
|
||||
})
|
||||
|
||||
@@ -34,7 +34,7 @@ const entregar = async (body) => {
|
||||
else if (res.Equipo.idStatus === 2)
|
||||
throw new Error('Ya se entrego el equipo al usuario.');
|
||||
else if (moment(res.horaMaxRecoger) < ahora)
|
||||
await Equipo.update({ idStatus: 3 }, { where: { idEquipo } })
|
||||
await Equipo.update({ idStatus: 4 }, { where: { idEquipo } })
|
||||
.then((res) =>
|
||||
Prestamo.update({ activo: false }, { where: { idPrestamo } })
|
||||
)
|
||||
|
||||
@@ -62,7 +62,7 @@ const pedir = async (body) => {
|
||||
);
|
||||
return Equipo.findOne({
|
||||
where: {
|
||||
idStatus: 3,
|
||||
idStatus: 4,
|
||||
idPrograma,
|
||||
},
|
||||
include: [
|
||||
|
||||
@@ -43,7 +43,7 @@ const regresar = async (body) => {
|
||||
fechaFin: ahoraAux.add(parseInt(diferencia / 15) * 7, 'd').format(),
|
||||
});
|
||||
return Equipo.update(
|
||||
{ idStatus: 3 },
|
||||
{ idStatus: 4 },
|
||||
{ where: { idEquipo: res.Equipo.idEquipo } }
|
||||
);
|
||||
})
|
||||
|
||||
@@ -50,7 +50,7 @@ const regresarNumeroInventario = async (body) => {
|
||||
fechaFin: ahoraAux.add(parseInt(diferencia / 15) * 7, 'd').format(),
|
||||
});
|
||||
return Equipo.update(
|
||||
{ idStatus: 3 },
|
||||
{ idStatus: 4 },
|
||||
{ where: { idEquipo: res.Equipo.idEquipo } }
|
||||
);
|
||||
})
|
||||
|
||||
@@ -110,7 +110,7 @@ const reporte = async (body) => {
|
||||
programa: res[i].Equipo.Programa
|
||||
? res[i].Equipo.Programa.programa
|
||||
: null,
|
||||
carrito: res[i].Equipo.Carrito.carrito,
|
||||
carrito: res[i].Equipo.Carrito.sobrenombre,
|
||||
modulo: res[i].Equipo.Carrito.Modulo.modulo,
|
||||
tipoCarrito: res[i].Equipo.Carrito.TipoCarrito.tipoCarrito,
|
||||
nombre: res[i].Usuario.nombre,
|
||||
|
||||
@@ -33,7 +33,7 @@ const status = async (body) => {
|
||||
} else message = 'El equipo ya fue entregado al usuario.';
|
||||
} else if (moment(res.horaMaxRecoger) < ahora) {
|
||||
await Equipo.update(
|
||||
{ idStatus: 3 },
|
||||
{ idStatus: 4 },
|
||||
{ where: { idEquipo: res.Equipo.idEquipo } }
|
||||
).then((res) =>
|
||||
Prestamo.update({ activo: false }, { where: { idPrestamo } })
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Op } = require('sequelize');
|
||||
const Status = require('../../db/tablas/Status');
|
||||
|
||||
const get = async () => Status.findAll({ where: { idStatus: { [Op.gt]: 2 } } });
|
||||
const get = async () => Status.findAll({ where: { idStatus: { [Op.gt]: 3 } } });
|
||||
|
||||
module.exports = get;
|
||||
|
||||
@@ -146,6 +146,7 @@ const dataStatus = async () => {
|
||||
const data = [
|
||||
'Apartado',
|
||||
'En uso',
|
||||
'Entrega inmediata',
|
||||
'Activo',
|
||||
'Cargando',
|
||||
'Reparación',
|
||||
|
||||
@@ -43,6 +43,11 @@ Prestamo.init(
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
regresoRapido: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: false,
|
||||
defaultValue: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
|
||||
Reference in New Issue
Block a user