From 7933605cb173b2b69fb960bd5ba7c20d9c47b401 Mon Sep 17 00:00:00 2001 From: evenegas Date: Wed, 21 Jan 2026 11:32:07 -0600 Subject: [PATCH 1/9] changes --- src/servicio/servicio.service.ts | 120 +++++++++++++++---------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/servicio/servicio.service.ts b/src/servicio/servicio.service.ts index b6f452d..72f1059 100644 --- a/src/servicio/servicio.service.ts +++ b/src/servicio/servicio.service.ts @@ -1581,76 +1581,76 @@ export class ServicioService { }, }); } - @Cron('0 0 * * *') - async diario(): Promise { - const now = moment().startOf('day'); - let mensaje = ''; + // @Cron('0 0 * * *') + // async diario(): Promise { + // const now = moment().startOf('day'); + // let mensaje = ''; - const servicios = await this.servicioRepo.find({ - where: { status: { idStatus: 3 } }, - relations: [ - 'status', - 'usuario', - 'programa', - 'programa.usuario', - ], - }); + // const servicios = await this.servicioRepo.find({ + // where: { status: { idStatus: 3 } }, + // relations: [ + // 'status', + // 'usuario', + // 'programa', + // 'programa.usuario', + // ], + // }); - for (const servicio of servicios) { - const fechaFin = moment(servicio.fechaFin).startOf('day'); + // for (const servicio of servicios) { + // const fechaFin = moment(servicio.fechaFin).startOf('day'); - const diferencia = fechaFin.diff(now, 'days'); + // const diferencia = fechaFin.diff(now, 'days'); - console.log("diferencia:", diferencia) + // console.log("diferencia:", diferencia) - // ===== 7 días antes ===== - if (diferencia === 7) { - const correoAlumno = avisoTerminoAlumno( - servicio.usuario.nombre, - ); + // // ===== 7 días antes ===== + // if (diferencia === 7) { + // const correoAlumno = avisoTerminoAlumno( + // servicio.usuario.nombre, + // ); - const correoResponsable = avisoTerminoResponsable( - servicio.usuario.nombre, - ); + // const correoResponsable = avisoTerminoResponsable( + // servicio.usuario.nombre, + // ); - mensaje += - `Se envió correo al alumno ${servicio.usuario.usuario} ` + - `con id ${servicio.usuario.idUsuario} al correo ${servicio.correo} ` + - `y al responsable ${servicio.programa.usuario.nombre} ` + - `con id ${servicio.programa.usuario.idUsuario} ` + - `y correo ${servicio.programa.usuario.usuario}\n\n`; + // mensaje += + // `Se envió correo al alumno ${servicio.usuario.usuario} ` + + // `con id ${servicio.usuario.idUsuario} al correo ${servicio.correo} ` + + // `y al responsable ${servicio.programa.usuario.nombre} ` + + // `con id ${servicio.programa.usuario.idUsuario} ` + + // `y correo ${servicio.programa.usuario.usuario}\n\n`; - await this.gmailService.enviarCorreo({ - subject: correoAlumno.subject, - to: servicio.correo, - text: correoAlumno.msj, - fecha_recibido: new Date(), - }); + // await this.gmailService.enviarCorreo({ + // subject: correoAlumno.subject, + // to: servicio.correo, + // text: correoAlumno.msj, + // fecha_recibido: new Date(), + // }); - await this.gmailService.enviarCorreo({ - subject: correoResponsable.subject, - to: servicio.programa.usuario.usuario, - text: correoResponsable.msj, - fecha_recibido: new Date(), - }); - } + // await this.gmailService.enviarCorreo({ + // subject: correoResponsable.subject, + // to: servicio.programa.usuario.usuario, + // text: correoResponsable.msj, + // fecha_recibido: new Date(), + // }); + // } - // ===== Servicio vencido ===== - else if (diferencia <= 0) { - mensaje += - `El servicio con id ${servicio.idServicio} ` + - `del alumno ${servicio.usuario.usuario} ` + - `con id ${servicio.usuario.idUsuario} ` + - `pasó al status 4\n\n`; + // // ===== Servicio vencido ===== + // else if (diferencia <= 0) { + // mensaje += + // `El servicio con id ${servicio.idServicio} ` + + // `del alumno ${servicio.usuario.usuario} ` + + // `con id ${servicio.usuario.idUsuario} ` + + // `pasó al status 4\n\n`; - await this.servicioRepo.update( - { idServicio: servicio.idServicio }, - { status: { idStatus: 4 } }, - ); - } - } + // await this.servicioRepo.update( + // { idServicio: servicio.idServicio }, + // { status: { idStatus: 4 } }, + // ); + // } + // } - // ===== Reporte ===== - console.log("se realizo carga masiva") - } + // // ===== Reporte ===== + // console.log("se realizo carga masiva") + // } } From f50ce6d5f9d3f0bcdb8c959234c62b13cff14e37 Mon Sep 17 00:00:00 2001 From: evenegas Date: Thu, 22 Jan 2026 12:10:38 -0600 Subject: [PATCH 2/9] creditos --- src/usuario/usuario.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/usuario/usuario.service.ts b/src/usuario/usuario.service.ts index 6754676..3c6e35e 100644 --- a/src/usuario/usuario.service.ts +++ b/src/usuario/usuario.service.ts @@ -24,14 +24,14 @@ export class UsuarioService { private readonly carreras: Record = { 'LIC. EN ACTUARIA': 64, 'LIC. EN ARQUITECTURA': 70, - 'LIC. EN CIENCIAS POLITICAS Y ADMON PUB': 67, - 'LIC. EN CIENCIAS POLITICAS Y ADMON.PUBL.': 67, - 'LIC. EN COMUNICACION': 67, + 'LIC. EN CIENCIAS POLITICAS Y ADMON PUB': 67.46, + 'LIC. EN CIENCIAS POLITICAS Y ADMON.PUBL.': 67.46, + 'LIC. EN COMUNICACION': 67.28, 'LIC. EN DERECHO': 68, 'LIC. EN DERECHO (SUA)': 67, 'LIC. EN DISEÑO GRAFICO': 70, - 'LIC. EN ECONOMIA': 66, - 'LIC. EN ENSEÑANZA DE INGLES': 69, + 'LIC. EN ECONOMIA': 66.35, + 'LIC. EN ENSEÑANZA DE INGLES': 69.89, 'LIC. EN FILOSOFIA': 70, 'LIC. EN HISTORIA': 70, 'LIC. EN INGENIERIA CIVIL': 70, From 02dd974fd6a87d9ff765911df0c4f45b7a6c4b28 Mon Sep 17 00:00:00 2001 From: evenegas Date: Fri, 23 Jan 2026 10:18:17 -0600 Subject: [PATCH 3/9] enviar diferente el caso especial --- src/caso-especial/caso-especial.controller.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/caso-especial/caso-especial.controller.ts b/src/caso-especial/caso-especial.controller.ts index 03824ef..0a6a62e 100644 --- a/src/caso-especial/caso-especial.controller.ts +++ b/src/caso-especial/caso-especial.controller.ts @@ -23,6 +23,7 @@ import { extname } from 'path'; import * as fs from 'fs'; import { FilterCasoEspecialDto } from './dto/filter-caso-especial.dto'; import { DriveService } from 'src/drive/drive.service'; +import { plainToInstance } from 'class-transformer'; @Controller('caso-especial') export class CasoEspecialController { @@ -46,11 +47,18 @@ export class CasoEspecialController { ) async subirArchivo( @UploadedFile() file: Express.Multer.File, - @Body('alumno') alumno: CreateCasoEspecialDto, + @Body('alumno') alumno: string, // 👈 STRING ) { try { - console.log('Archivo recibido:', alumno); - return await this.casoEspecialService.create(alumno, file.filename); + const alumnoParsed = plainToInstance( + CreateCasoEspecialDto, + JSON.parse(alumno), + ); + + return await this.casoEspecialService.create( + alumnoParsed, + file.filename, + ); } catch (err) { if (file?.filename) { fs.unlinkSync(`./server/uploads/${file.filename}`); From 1155735d9d746f9204ef2f4f71d3c9a8f29d777c Mon Sep 17 00:00:00 2001 From: evenegas Date: Wed, 28 Jan 2026 12:16:16 -0600 Subject: [PATCH 4/9] log --- src/usuario/usuario.service.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/usuario/usuario.service.ts b/src/usuario/usuario.service.ts index 3c6e35e..4c0369c 100644 --- a/src/usuario/usuario.service.ts +++ b/src/usuario/usuario.service.ts @@ -24,14 +24,14 @@ export class UsuarioService { private readonly carreras: Record = { 'LIC. EN ACTUARIA': 64, 'LIC. EN ARQUITECTURA': 70, - 'LIC. EN CIENCIAS POLITICAS Y ADMON PUB': 67.46, - 'LIC. EN CIENCIAS POLITICAS Y ADMON.PUBL.': 67.46, - 'LIC. EN COMUNICACION': 67.28, + 'LIC. EN CIENCIAS POLITICAS Y ADMON PUB': 67, + 'LIC. EN CIENCIAS POLITICAS Y ADMON.PUBL.': 67, + 'LIC. EN COMUNICACION': 67, 'LIC. EN DERECHO': 68, 'LIC. EN DERECHO (SUA)': 67, 'LIC. EN DISEÑO GRAFICO': 70, - 'LIC. EN ECONOMIA': 66.35, - 'LIC. EN ENSEÑANZA DE INGLES': 69.89, + 'LIC. EN ECONOMIA': 66, + 'LIC. EN ENSEÑANZA DE INGLES': 69, 'LIC. EN FILOSOFIA': 70, 'LIC. EN HISTORIA': 70, 'LIC. EN INGENIERIA CIVIL': 70, @@ -157,7 +157,7 @@ export class UsuarioService { }); alum = await this.userRepo.save(nuevoUsuario); } - + console.log("Alumno:", alumno); return { ...alumno, idUsuario: alum.idUsuario }; } From 017e6836e9ef902d5ec21fd0e815daf87add2576 Mon Sep 17 00:00:00 2001 From: evenegas Date: Thu, 29 Jan 2026 09:50:55 -0600 Subject: [PATCH 5/9] =?UTF-8?q?se=20agreg=C3=B3=20la=20relacion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/caso-especial/caso-especial.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/caso-especial/caso-especial.service.ts b/src/caso-especial/caso-especial.service.ts index a64f656..93fdbd3 100644 --- a/src/caso-especial/caso-especial.service.ts +++ b/src/caso-especial/caso-especial.service.ts @@ -163,7 +163,7 @@ export class CasoEspecialService { const caso = await this.casoEspecialRepository.findOne({ where: { idCasoEspecial }, - relations: ['usuario'], + relations: ['usuario', 'status'], }); if (!caso) { From 29b0f2b3e5d96ece1275e16970691677701652a4 Mon Sep 17 00:00:00 2001 From: evenegas Date: Thu, 29 Jan 2026 09:59:42 -0600 Subject: [PATCH 6/9] =?UTF-8?q?se=20agreg=C3=B3=20la=20relacion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/caso-especial/caso-especial.service.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/caso-especial/caso-especial.service.ts b/src/caso-especial/caso-especial.service.ts index 93fdbd3..f4b4aac 100644 --- a/src/caso-especial/caso-especial.service.ts +++ b/src/caso-especial/caso-especial.service.ts @@ -176,9 +176,8 @@ export class CasoEspecialService { const correo = terminoValidado(caso.usuario.nombre); // Actualiza el status según el caso - update = { - idStatus: caso.status.idStatus === 11 ? 13 : 14, - }; + caso.status.idStatus = caso.status.idStatus === 11 ? 13 : 14; + await this.casoEspecialRepository.save(caso); let sendMessage: SendMailDto = { to: caso.correo, @@ -202,8 +201,6 @@ export class CasoEspecialService { throw new BadRequestException('Id status no válido.'); } - // Actualiza en base de datos - await this.casoEspecialRepository.update({ idCasoEspecial }, update); return { message: From 313bc7e632f12dd95c2c3c52e04ce1ef75559267 Mon Sep 17 00:00:00 2001 From: evenegas Date: Thu, 29 Jan 2026 12:05:08 -0600 Subject: [PATCH 7/9] se agregaron cambios --- src/caso-especial/caso-especial.service.ts | 3 +++ src/caso-especial/dto/update-caso-especial.dto.ts | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/caso-especial/caso-especial.service.ts b/src/caso-especial/caso-especial.service.ts index f4b4aac..33e0493 100644 --- a/src/caso-especial/caso-especial.service.ts +++ b/src/caso-especial/caso-especial.service.ts @@ -17,6 +17,9 @@ import { Status } from 'src/status/entities/status.entity'; import { FilterCasoEspecialDto } from './dto/filter-caso-especial.dto'; import { arch } from 'os'; import { SendMailDto } from 'src/helpers.services/dto/send-email.dto'; +const { + terminoValidado +} = require('./../helpers.services/msjCorreos'); @Injectable() export class CasoEspecialService { diff --git a/src/caso-especial/dto/update-caso-especial.dto.ts b/src/caso-especial/dto/update-caso-especial.dto.ts index 234412d..8741d15 100644 --- a/src/caso-especial/dto/update-caso-especial.dto.ts +++ b/src/caso-especial/dto/update-caso-especial.dto.ts @@ -14,15 +14,15 @@ export class UpdateCasoEspecialDto { @IsOptional() @IsDateString() - fechaInicio?: Date; + fechaInicio?: string; @IsOptional() @IsDateString() - fechaFin?: Date; + fechaFin?: string; @IsOptional() @IsDateString() - fechaNacimiento?: Date; + fechaNacimiento?: string; @IsOptional() @IsString() From 1a0af95c4ef1ce4d57fcf7c8e1d659aa7ffbbe84 Mon Sep 17 00:00:00 2001 From: evenegas Date: Thu, 29 Jan 2026 12:10:46 -0600 Subject: [PATCH 8/9] se agregaron cambios --- src/caso-especial/entities/caso-especial.entity.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/caso-especial/entities/caso-especial.entity.ts b/src/caso-especial/entities/caso-especial.entity.ts index 757d5cb..aa55286 100644 --- a/src/caso-especial/entities/caso-especial.entity.ts +++ b/src/caso-especial/entities/caso-especial.entity.ts @@ -38,14 +38,14 @@ export class CasoEspecial { @Column({ name: 'direccion', type: 'varchar', length: 200, nullable: false }) direccion: string; - @Column({ name: 'fechaInicio', type: 'datetime', nullable: false }) - fechaInicio: Date; + @Column({ name: 'fechaInicio', type: 'date', nullable: false }) + fechaInicio: string; - @Column({ name: 'fechaFin', type: 'datetime', nullable: false }) - fechaFin: Date; + @Column({ name: 'fechaFin', type: 'date', nullable: false }) + fechaFin: string; - @Column({ name: 'fechaNacimiento', type: 'datetime', nullable: false }) - fechaNacimiento: Date; + @Column({ name: 'fechaNacimiento', type: 'date', nullable: false }) + fechaNacimiento: string; @Column({ name: 'carpeta', type: 'varchar', length: 60, nullable: false }) carpeta: string; From c73121f7dfe5dc3eff2d9e89d76a33fa6ad98af2 Mon Sep 17 00:00:00 2001 From: evenegas Date: Thu, 26 Feb 2026 14:22:33 -0600 Subject: [PATCH 9/9] se agregaron funciones para actualizar usuario --- src/auth/auth.controller.ts | 15 +++++++++++++-- src/auth/auth.service.ts | 14 ++++++++++++++ src/usuario/usuario.controller.ts | 5 +++++ src/usuario/usuario.service.ts | 4 ++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 3c8ee7c..704de9a 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -7,10 +7,10 @@ import { UnauthorizedException, } from '@nestjs/common'; import { AuthService } from './auth.service'; - + @Controller('auth') export class AuthController { - constructor(private readonly authService: AuthService) {} + constructor(private readonly authService: AuthService) { } // ===================== LOGIN ===================== @Post('login') @@ -36,4 +36,15 @@ export class AuthController { throw new UnauthorizedException(error.message); } } + + // ===================== ACTUALIZAR CONTRASEÑA ADMIN ===================== + @Post('update-password') + async updatePassword() { + try { + const newPassword = await this.authService.update_password(); + return { message: 'Contraseña actualizada correctamente.', contraseña: newPassword }; + } catch (error) { + throw new UnauthorizedException(error.message); + } + } } diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index e127f1d..ca1e84e 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -73,6 +73,20 @@ export class AuthService { return password; } + async update_password() { + let user = await this.userRepo.findOne({ where: { tipoUsuario: { idTipoUsuario: 1 } } }) + + if (!user) throw new NotFoundException('No se encontró el usuario administrador.'); + const newPassword = await this.generarPassword(); + const hashedPassword = await this.encriptar(newPassword); + user.password = hashedPassword; + await this.userRepo.save(user); + return newPassword; + } + + + + async login(usuario: string, password: string) { const user = await this.userRepo.findOne({ where: { usuario }, diff --git a/src/usuario/usuario.controller.ts b/src/usuario/usuario.controller.ts index 5d7275b..5aa3b51 100644 --- a/src/usuario/usuario.controller.ts +++ b/src/usuario/usuario.controller.ts @@ -91,6 +91,11 @@ export class UsuarioController { ); } + @Get('tipos-usuario') + async findTiposUsuario() { + return await this.usuarioService.findAll(); + } + } diff --git a/src/usuario/usuario.service.ts b/src/usuario/usuario.service.ts index 4c0369c..4411d28 100644 --- a/src/usuario/usuario.service.ts +++ b/src/usuario/usuario.service.ts @@ -361,6 +361,10 @@ export class UsuarioService { }; } + async findAll() { + return await this.tipoUsurioRepo.find() + } + /*c obtenerTodosLosUsuarios() { return await this.userRepo.find({ relations: ['tipoUsuario'],