busca las claves con año actual
This commit is contained in:
@@ -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}%`),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user