Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1abf4d4e9c | |||
| 3ef076111e | |||
| a387f11302 | |||
| e336f0bb86 | |||
| e5f98c9596 | |||
| 24717cf931 | |||
| b6e7525dc2 | |||
| bc975bc295 | |||
| cb82dd3354 | |||
| a18fbe441d | |||
| c42c87e080 | |||
| 3bc245e1f7 | |||
| 5c5e7b3f0f |
+3
-2
@@ -2,7 +2,8 @@
|
||||
/dist
|
||||
/node_modules
|
||||
/build
|
||||
|
||||
/server/uploads
|
||||
/server
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
@@ -13,7 +14,7 @@ yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
/initdb/init.sql
|
||||
|
||||
/initdb2
|
||||
# OS
|
||||
.DS_Store
|
||||
|
||||
|
||||
@@ -18,9 +18,11 @@ 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 {
|
||||
constructor(
|
||||
|
||||
@@ -27,7 +27,6 @@ export class CreateCasoEspecialDto {
|
||||
idStatus: number;
|
||||
|
||||
@IsString()
|
||||
@Length(9, 9)
|
||||
@Matches(/^\d+$/, { message: 'solo puede contener números' })
|
||||
numeroCuenta: string;
|
||||
|
||||
|
||||
@@ -1,145 +1,143 @@
|
||||
import { Servicio } from "src/servicio/entities/servicio.entity";
|
||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Servicio } from 'src/servicio/entities/servicio.entity';
|
||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity('cuestionario_alumno_2')
|
||||
export class CuestionarioAlumno2 {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
idCuestionarioAlumno2: number;
|
||||
|
||||
@Column({ type: 'varchar', length: 100, nullable: false })
|
||||
@Column({ type: 'text', nullable: true })
|
||||
p1: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 50, nullable: false })
|
||||
@Column({ type: 'varchar', length: 200, nullable: true })
|
||||
p2: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 200, nullable: true })
|
||||
p4: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
@Column({ type: 'varchar', length: 500, nullable: true })
|
||||
p5: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 200, nullable: true })
|
||||
p6: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 200, nullable: true })
|
||||
p7: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
@Column({ type: 'varchar', length: 500, nullable: true })
|
||||
p8: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 200, nullable: true })
|
||||
p9: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
p3_1: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
p3_2: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
p3_3: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
p3_4: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p10_1: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p10_2: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p10_3: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p11_1: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p11_2: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p11_3: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p11_4: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p12_A_1: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p12_A_2: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p12_A_3: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p12_A_4: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p12_B_1: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p12_B_2: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p12_B_3: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p12_B_4: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p12_C_1: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p12_C_2: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p12_C_3: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p12_C_4: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
p12_D_1: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
p12_D_2: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
p12_D_3: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
p12_D_4: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, nullable: false })
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
p12_D_5: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 100, nullable: false })
|
||||
@Column({ type: 'varchar', length: 200, nullable: true })
|
||||
p13: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 100, nullable: false })
|
||||
@Column({ type: 'varchar', length: 200, nullable: true })
|
||||
p14: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 200, nullable: true })
|
||||
p15: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
@Column({ type: 'varchar', length: 500, nullable: true })
|
||||
p16: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p17_1: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p17_2: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 5, nullable: false })
|
||||
@Column({ type: 'varchar', length: 20, nullable: true })
|
||||
p17_3: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
@Column({ type: 'varchar', length: 500, nullable: true })
|
||||
p18: string;
|
||||
|
||||
@OneToMany(()=>Servicio,(servicio)=>servicio.cuestionarioAlumno2)
|
||||
servicio:Servicio[];
|
||||
|
||||
@OneToMany(() => Servicio, (servicio) => servicio.cuestionarioAlumno2)
|
||||
servicio: Servicio[];
|
||||
}
|
||||
|
||||
@@ -1581,76 +1581,76 @@ export class ServicioService {
|
||||
},
|
||||
});
|
||||
}
|
||||
// @Cron('0 0 * * *')
|
||||
// async diario(): Promise<void> {
|
||||
// const now = moment().startOf('day');
|
||||
// let mensaje = '';
|
||||
@Cron('0 0 * * *')
|
||||
async diario(): Promise<void> {
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ export class UsuarioService {
|
||||
});
|
||||
alum = await this.userRepo.save(nuevoUsuario);
|
||||
}
|
||||
console.log("Alumno:", alumno);
|
||||
console.log("el alumno es:", alumno);
|
||||
return { ...alumno, idUsuario: alum.idUsuario };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user