From f8b61e48cb995c5f2dc28d93c68c0de92cf6e23e Mon Sep 17 00:00:00 2001 From: xXpuma99Xx <51341582+xXpuma99Xx@users.noreply.github.com> Date: Sun, 2 Oct 2022 23:24:51 -0500 Subject: [PATCH] =?UTF-8?q?listo=20para=20producci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.gateway.ts | 8 ++--- src/equipo/equipo.service.ts | 2 -- src/prestamo/prestamo.service.ts | 57 ++++++++++++++++---------------- 3 files changed, 32 insertions(+), 35 deletions(-) diff --git a/src/app.gateway.ts b/src/app.gateway.ts index c22d4f7..4b7d086 100644 --- a/src/app.gateway.ts +++ b/src/app.gateway.ts @@ -10,15 +10,15 @@ import { Socket, Server } from 'socket.io'; @WebSocketGateway({ cors: { origin: [ - 'http://localhost:3176', - 'http://localhost:3186', + // 'http://localhost:3176', + // 'http://localhost:3186', // 'http://132.248.80.196:3155', // 'http://132.248.80.196:3185', // 'https://pmodulospcpuma.unam.mx', // 'https://pmodulospcpuma.unam.mx:3015', // 'https://modulospcpuma.unam.mx', - // 'https://modulospcpuma.unam.mx:3015', - // 'https://betelgeuse.acatlan.unam.mx:3180', + 'https://modulospcpuma.unam.mx:3015', + 'https://betelgeuse.acatlan.unam.mx:3180', ], }, }) diff --git a/src/equipo/equipo.service.ts b/src/equipo/equipo.service.ts index 4d722c8..833f0da 100644 --- a/src/equipo/equipo.service.ts +++ b/src/equipo/equipo.service.ts @@ -34,8 +34,6 @@ import { ModuloService } from '../modulo/modulo.service'; import { EquipoMotivoService } from '../equipo-motivo/equipo-motivo.service'; import { OperadorService } from '../operador/operador.service'; import { StatusService } from '../status/status.service'; -import internal from 'stream'; -import { retry } from 'rxjs'; @Injectable() export class EquipoService { diff --git a/src/prestamo/prestamo.service.ts b/src/prestamo/prestamo.service.ts index a1c4061..479585b 100644 --- a/src/prestamo/prestamo.service.ts +++ b/src/prestamo/prestamo.service.ts @@ -37,7 +37,6 @@ import { ModuloService } from '../modulo/modulo.service'; import { MultaService } from '../multa/multa.service'; import { OperadorService } from '../operador/operador.service'; import { TipoUsuarioService } from '../tipo-usuario/tipo-usuario.service'; -import { UsuarioService } from '../usuario/usuario.service'; @Injectable() export class PrestamoService { @@ -61,7 +60,6 @@ export class PrestamoService { private multaService: MultaService, private operadorService: OperadorService, private tipoUsuarioService: TipoUsuarioService, - private usuarioService: UsuarioService, ) {} async cancelarOperador( @@ -150,34 +148,34 @@ export class PrestamoService { ) : null; - // if (ahora.weekday() === 0) - // throw new ConflictException('No hay servicio los días domingo.'); - // this.validarInstitucionUsuario(usuario.instituciones, modulo); - // if (!institucionDia.activo) - // throw new ConflictException( - // 'El día de hoy no hay servicio de préstamo de equipos.', - // ); - // if (ahora < horaMin) - // throw new ConflictException( - // `El servicio inicia a las ${institucionDia.hora_inicio} el día de hoy.`, - // ); - // if (ahora >= horaExtra) - // throw new ConflictException( - // `El servicio terminó a las ${institucionDia.hora_extra} el día de hoy.`, - // ); - // for (let i = 0; i < institucionDia.horasExcepcion.length; i++) { - // const horaFin = moment( - // `${ahoraStr} ${institucionDia.horasExcepcion[i].hora_fin}`, - // ); - // const horaInicio = moment( - // `${ahoraStr} ${institucionDia.horasExcepcion[i].hora_inicio}`, - // ); + if (ahora.weekday() === 0) + throw new ConflictException('No hay servicio los días domingo.'); + this.validarInstitucionUsuario(usuario.instituciones, modulo); + if (!institucionDia.activo) + throw new ConflictException( + 'El día de hoy no hay servicio de préstamo de equipos.', + ); + if (ahora < horaMin) + throw new ConflictException( + `El servicio inicia a las ${institucionDia.hora_inicio} el día de hoy.`, + ); + if (ahora >= horaExtra) + throw new ConflictException( + `El servicio terminó a las ${institucionDia.hora_extra} el día de hoy.`, + ); + for (let i = 0; i < institucionDia.horasExcepcion.length; i++) { + const horaFin = moment( + `${ahoraStr} ${institucionDia.horasExcepcion[i].hora_fin}`, + ); + const horaInicio = moment( + `${ahoraStr} ${institucionDia.horasExcepcion[i].hora_inicio}`, + ); - // if (ahora > horaInicio && ahora < horaFin) - // throw new ConflictException( - // `Se suspendió temporalmente el servicio de ${institucionDia.horasExcepcion[i].hora_inicio} a ${institucionDia.horasExcepcion[i].hora_fin}.`, - // ); - // } + if (ahora > horaInicio && ahora < horaFin) + throw new ConflictException( + `Se suspendió temporalmente el servicio de ${institucionDia.horasExcepcion[i].hora_inicio} a ${institucionDia.horasExcepcion[i].hora_fin}.`, + ); + } return this.informacionPrestamoView .findOne({ where: { activo: 1, id_usuario: usuario.id_usuario } }) .then((existePrestamo) => { @@ -793,6 +791,7 @@ export class PrestamoService { prestamo.activo = false; prestamo.fecha_entrega = ahora.toDate(); prestamo.operadorRegreso = operadorRegreso; + prestamo.equipo.u = null; if (semanasCastigo > 0) { const mensajeTardanza = `El usaurio se tardó: ${tardanza} minutos en entregar el equipo de cómputo.`;