aparentemente versión final
This commit is contained in:
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "api",
|
||||
"name": "citas_recorridos_api",
|
||||
"version": "1.0.0",
|
||||
"description": "Esta es la plantilla para una api",
|
||||
"description": "Esta es la api del sistema de recorridos de acatlan.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node ./server/config/test",
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
const moment = require('moment');
|
||||
|
||||
const correoPrimerSemestre = (numeroCuenta, nombre, lic, date) => {
|
||||
const fecha = moment(date);
|
||||
|
||||
return {
|
||||
subject: `Comprobante de registro recorrido.`,
|
||||
message: `<h1>Estimada(o) nombre ${nombre}</h1>
|
||||
message: `<h2>Estimada(o) ${nombre}</h2>
|
||||
<h3></h3>Alumna(o) de la Generación 2022,<br>Licenciatura: ${lic}</h3>
|
||||
|
||||
<p>
|
||||
@@ -13,7 +15,9 @@ const correoPrimerSemestre = (numeroCuenta, nombre, lic, date) => {
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Te esperamos en la entrada peatonal de la Facultad (sobre Av. San Juan Totoltepec), el próximo ${fecha.year()}/${fecha.month()}/${fecha.date()} a las ${fecha.hour()}:${
|
||||
Te esperamos en la entrada peatonal de la Facultad (sobre Av. San Juan Totoltepec), el próximo ${fecha.year()}/${
|
||||
fecha.month() + 1
|
||||
}/${fecha.date()} a las ${fecha.hour()}:${
|
||||
fecha.minute() < 10 ? '0' + fecha.minute() : fecha.minute()
|
||||
}.
|
||||
</p>
|
||||
@@ -65,12 +69,14 @@ const correoTercerSemestre = (numeroCuenta, nombre, lic, date) => {
|
||||
|
||||
return {
|
||||
subject: `Comprobante de registro recorrido.`,
|
||||
message: `<h1>Estimada(o) nombre ${nombre}</h1>
|
||||
message: `<h2>Estimada(o) ${nombre}</h2>
|
||||
<h3></h3>Alumna(o) de la Generación 2021,<br>Licenciatura: ${lic}</h3>
|
||||
|
||||
<p>
|
||||
Gracias por registrarte para participar en este recorrido por la FES Acatlán, tu Facultad. La cita es en
|
||||
la entrada peatonal (sobre Av. San Juan Totoltepec), el próximo ${fecha.year()}/${fecha.month()}/${fecha.date()} a las ${fecha.hour()}:${
|
||||
la entrada peatonal (sobre Av. San Juan Totoltepec), el próximo ${fecha.year()}/${
|
||||
fecha.month() + 1
|
||||
}/${fecha.date()} a las ${fecha.hour()}:${
|
||||
fecha.minute() < 10 ? '0' + fecha.minute() : fecha.minute()
|
||||
}. Te pedimos
|
||||
asistir en la fecha y horarios asignados de acuerdo con tu licenciatura (no pueden ser modificados).
|
||||
|
||||
Reference in New Issue
Block a user