listo socket

This commit is contained in:
xXpuma99Xx
2022-01-25 22:08:13 -06:00
parent e8f9a96ecf
commit 833dc127be
12 changed files with 81 additions and 115 deletions
+3 -1
View File
@@ -1,4 +1,5 @@
const moment = require('moment');
const io = require('../../socket');
const { validarNumeroEntero } = require('../../helper/validar');
const dbPath = '../../db/tablas';
const Carrito = require(`${dbPath}/Carrito`);
@@ -8,9 +9,9 @@ const Prestamo = require(`${dbPath}/Prestamo`);
const Programa = require(`${dbPath}/Programa`);
const Status = require(`${dbPath}/Status`);
const TipoCarrito = require(`${dbPath}/TipoCarrito`);
const ahora = moment();
const status = async (body) => {
const ahora = moment();
const idPrestamo = validarNumeroEntero(body.idPrestamo, 'id prestamo', true);
let message = '';
let atraso = false;
@@ -39,6 +40,7 @@ const status = async (body) => {
);
message =
'Ya paso el tiempo limite para recoger el dispositivo. Se ha cancelado tu prestamo.';
io.getIO().emit('actualizar');
} else message = 'Aun no se entrega el equipo al usuario.';
return Prestamo.findOne({
where: { idPrestamo },