aparentemente versión final
This commit is contained in:
@@ -17,10 +17,13 @@ const get = async (body) => {
|
||||
const correo = validar.validarCorreo(body.correo);
|
||||
const nombre = validar.validarTexto(body.nombre, 'El nombre', 70);
|
||||
let mail = {};
|
||||
let horario = {};
|
||||
let carrera = {};
|
||||
|
||||
return Carrera.findOne({ where: { idCarrera } })
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No existe esta carrera.');
|
||||
carrera = res;
|
||||
return Grupo.findOne({
|
||||
where: { idGrupo },
|
||||
});
|
||||
@@ -40,6 +43,7 @@ const get = async (body) => {
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No existe este horario.');
|
||||
horario = res;
|
||||
return CarreraHorario.findOne({ where: { idCarrera, idHorario } });
|
||||
})
|
||||
.then((res) => {
|
||||
@@ -64,7 +68,12 @@ const get = async (body) => {
|
||||
});
|
||||
})
|
||||
.then((res) => {
|
||||
mail = correos(res.nombre, res.numeroCuenta);
|
||||
mail = correos.correoPrimerSemestre(
|
||||
res.numeroCuenta,
|
||||
res.nombre,
|
||||
carrera.carrera,
|
||||
horario.horario
|
||||
);
|
||||
return gmail(mail.subject, res.correo, mail.message);
|
||||
})
|
||||
.then((res) => ({
|
||||
|
||||
@@ -3,22 +3,38 @@ const gmail = require(`${helperPath}/gmail`);
|
||||
const correos = require(`${helperPath}/correos`);
|
||||
const { validarId } = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Grupo = require(`${dbPath}/Grupo`);
|
||||
const GrupoHorario = require(`${dbPath}/GrupoHorario`);
|
||||
const Horario = require(`${dbPath}/Horario`);
|
||||
const TercerSemestre = require(`${dbPath}/TercerSemestre`);
|
||||
|
||||
const get = async (body) => {
|
||||
const idTercerSemestre = validarId(body.idTercerSemestre);
|
||||
let alumno = {};
|
||||
let mail = {};
|
||||
/*
|
||||
Falta
|
||||
Enviar correo con qr de confirmación de su registro a su
|
||||
email pcpuma
|
||||
*/
|
||||
return TercerSemestre.findOne({ where: { idTercerSemestre } })
|
||||
|
||||
return TercerSemestre.findOne({
|
||||
where: { idTercerSemestre },
|
||||
include: [{ model: Grupo, include: [{ model: Carrera }] }],
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No existe esta alumno.');
|
||||
if (res.deseaAsistir)
|
||||
throw new Error('Ya se registro a este alumno al recorrido.');
|
||||
mail = correos(res.nombre, res.numeroCuenta);
|
||||
alumno = res;
|
||||
return GrupoHorario.findOne({
|
||||
where: { idGrupo: alumno.idGrupo },
|
||||
include: [{ model: Horario }],
|
||||
});
|
||||
})
|
||||
.then((res) => {
|
||||
mail = correos.correoTercerSemestre(
|
||||
alumno.numeroCuenta,
|
||||
alumno.nombre,
|
||||
alumno.Grupo.Carrera.carrera,
|
||||
res.Horario.horario
|
||||
);
|
||||
return gmail(
|
||||
mail.subject,
|
||||
'lemuelhelonmarquezrosas@gmail.com',
|
||||
|
||||
Reference in New Issue
Block a user