From f70aa0f92e935a986dc3708b2007f86029ffc634 Mon Sep 17 00:00:00 2001 From: evenegas Date: Thu, 15 Jan 2026 12:13:16 -0600 Subject: [PATCH] =?UTF-8?q?busca=20las=20claves=20con=20a=C3=B1o=20actual?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/programa/programa.service.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/programa/programa.service.ts b/src/programa/programa.service.ts index 0853974..e14e0f6 100644 --- a/src/programa/programa.service.ts +++ b/src/programa/programa.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { Repository } from 'typeorm'; +import { Like, Repository } from 'typeorm'; import * as csv from 'csvtojson'; import * as fs from 'fs'; import * as path from 'path'; @@ -52,7 +52,7 @@ export class ProgramaService { try { this.validacionService.validarCorreo(prog.correo); - } catch(err) { + } catch (err) { console.log(err) mensaje += 'Correo inválido. Línea omitida.\n\n'; continue; @@ -71,14 +71,14 @@ export class ProgramaService { }); //Agregamos esta linea para verificar los logs - console.log("prog:", prog); - + console.log("prog:", prog); + if (!responsable) { - let contraseña=await this.authService.generarPassword(); + let contraseña = await this.authService.generarPassword(); const password = await this.authService.encriptar(contraseña); - + const correoInfo = enviarSec(contraseña, prog.correo, prog.nombre); @@ -205,8 +205,12 @@ export class ProgramaService { if (usuario.tipoUsuario.idTipoUsuario !== 2) { throw new Error('No es un usuario de tipo responsable'); } - return this.programaRepo.find({ - where: { usuario: { idUsuario } }, + const year = new Date().getFullYear().toString(); + + return await this.programaRepo.find({ + where: { + usuario: { idUsuario }, clavePrograma: Like(`${year}%`), + }, }); }