This commit is contained in:
xXpuma99Xx
2021-10-24 20:22:40 -05:00
42 changed files with 1291 additions and 2293 deletions
+2
View File
@@ -5,3 +5,5 @@ node_modules/
server/db/alumnos_segundo.csv
server/uploads/*
server/db/generacion2021.csv
+997 -822
View File
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
const { validarNumeroCuenta } = require('../../helper/validar');
const dbPath = '../../db/tablas';
const Alumno = require(`${dbPath}/Alumno`);
const Carrera = require(`${dbPath}/Carrera`);
const get = async (body) => {
const numeroCuenta = validarNumeroCuenta(body.numeroCuenta);
return Alumno.findOne({
where: { numeroCuenta },
include: [{ model: Carrera }],
}).then((res) => {
if (!res) throw new Error('No existe este número de cuenta.');
if (res.idHorario)
throw new Error('Este alumno ya cuenta con un horario asignado.');
delete res.dataValues.idCarrera;
return res;
});
};
module.exports = get;
+28
View File
@@ -0,0 +1,28 @@
const dbPath = '../../db/tablas';
const Alumno = require(`${dbPath}/Alumno`);
const Carrera = require(`${dbPath}/Carrera`);
const Horario = require(`${dbPath}/Horario`);
const monitor = async () => {
const data = [];
return Horario.findAll().then(async (res) => {
for (let i = 0; i < res.length; i++) {
const Asistentes = await Alumno.findAll({
where: { idHorario: res[i].idHorario },
include: [{ model: Carrera }],
}).then((res) => {
for (let j = 0; j < res.length; j++) {
delete res[j].dataValues.idCarrera;
delete res[j].dataValues.idHorario;
}
return res;
});
data.push({ Horario: res[i], Asistentes });
}
return data;
});
};
module.exports = monitor;
+43
View File
@@ -0,0 +1,43 @@
const moment = require('moment');
const dbHelper = '../../helper';
const gmail = require(`${dbHelper}/gmail`);
const { correoAsistencia } = require(`${dbHelper}/correos`);
const { validarId } = require(`${dbHelper}/validar`);
const dbPath = '../../db/tablas';
const Alumno = require(`${dbPath}/Alumno`);
const Horario = require(`${dbPath}/Horario`);
const ahora = moment();
const pasarLista = async (body) => {
const idAlumno = validarId(body.idAlumno);
let correo = {};
let horario = moment();
return Alumno.findOne({
where: { idAlumno },
include: [{ model: Horario }],
})
.then((res) => {
if (!res) throw new Error('No existe este alumno.');
horario = moment(res.Horario.horario);
if (res.asistio) throw new Error('Ya paso lista a este alumno.');
if (ahora < horario) throw new Error('Aun no es la hora del recorrido.');
horario.add(20, 'm');
if (ahora > horario) throw new Error('Ya paso la hora del recorrido.');
return Alumno.update({ asistio: true }, { where: { idAlumno } });
})
.then((res) => {
correo = correoAsistencia();
return gmail(
correo.subject,
'lemuelhelonmarquezrosas@gmail.com',
correo.message
);
})
.then((res) => {
console.log(res);
return { message: 'Se paso lista correctamente.' };
});
};
module.exports = pasarLista;
+60
View File
@@ -0,0 +1,60 @@
const dbHelper = '../../helper';
const { validarId } = require(`${dbHelper}/validar`);
const { correoAlumno } = require(`${dbHelper}/correos`);
const gmail = require(`${dbHelper}/gmail`);
const dbPath = '../../db/tablas';
const Alumno = require(`${dbPath}/Alumno`);
const Carrera = require(`${dbPath}/Carrera`);
const Horario = require(`${dbPath}/Horario`);
const registrar = async (body) => {
const idHorario = validarId(body.idHorario);
const idAlumno = validarId(body.idAlumno);
let alumno = {};
let horario = {};
let correo = {};
return Alumno.findOne({
where: { idAlumno },
include: [{ model: Carrera }],
})
.then((res) => {
if (!res) throw new Error('No existe este alumno.');
if (res.idHorario)
throw new Error('Este alumno ya tiene un horario asignado.');
alumno = res;
return Horario.findOne({ where: { idHorario } });
})
.then((res) => {
if (!res) throw new Error('No existe este horario.');
horario = res;
if (alumno.turno != horario.turno)
throw new Error('Este horario no corresponde con el turno del alumno.');
return Alumno.findAll({ where: { idHorario } });
})
.then((res) => {
if (res.length > 50)
throw new Error('Ya no hay espacio en este horario.');
return Alumno.update({ idHorario }, { where: { idAlumno } });
})
.then((res) => {
correo = correoAlumno(
alumno.numeroCuenta,
alumno.Carrera.carrera,
horario.horario,
alumno.idAlumno
);
return gmail(
correo.subject,
'lemuelhelonmarquezrosas@gmail.com',
// `${alumno.numeroCuenta@pcpuma.acatlan.unam.mx`
correo.message
);
})
.then((res) => ({
message:
'Se registro correctamente tu horario. Se envio una comprobante a tu correo pcpuma.',
}));
};
module.exports = registrar;
+10
View File
@@ -0,0 +1,10 @@
const dbHelper = '../../helper';
const { validarId } = require(`${dbHelper}/validar`);
const dbPath = '../../db/tablas';
const Alumno = require(`${dbPath}/Alumno`);
const AlumnoHorario = require(`${dbPath}/AlumnoHorario`);
const Horario = require(`${dbPath}/Horario`);
const reporte = async (body) => {};
module.exports = reporte;
-5
View File
@@ -1,5 +0,0 @@
const Carrera = require('../../db/tablas/Carrera');
const get = async () => Carrera.findAll();
module.exports = get;
-37
View File
@@ -1,37 +0,0 @@
const { validarId } = require('../../helper/validar');
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
const CarreraHorario = require(`${dbPath}/CarreraHorario`);
const Horario = require(`${dbPath}/Horario`);
const PrimerSemestre = require(`${dbPath}/PrimerSemestre`);
const get = async (body) => {
const idCarrera = validarId(body.idCarrera);
const data = [];
return Carrera.findOne({ where: { idCarrera } })
.then((res) => {
if (!res) throw new Error('No existe esta carrera.');
return CarreraHorario.findAll({
where: { idCarrera },
include: [{ model: Horario }],
});
})
.then(async (res) => {
for (let i = 0; i < res.length; i++) {
const lugaresOcupados = await PrimerSemestre.findAll({
where: { idHorario: res[i].Horario.idHorario },
}).then((res) => res.length);
if (lugaresOcupados < 45)
data.push({
idHorario: res[i].Horario.idHorario,
horario: res[i].Horario.horario,
lugares: 45 - lugaresOcupados,
});
}
return data;
});
};
module.exports = get;
@@ -1,21 +0,0 @@
const moment = require('moment');
const dbPath = '../../db/tablas';
const CarreraHorario = require(`${dbPath}/CarreraHorario`);
const Horario = require(`${dbPath}/Horario`);
const hoy = moment();
const horariosDia = async (body) => {
const data = [];
return CarreraHorario.findAll({
include: [{ model: Horario }],
order: ['idHorario'],
}).then(async (res) => {
for (let i = 0; i < res.length; i++)
if (hoy.dayOfYear() === moment(res[i].Horario.horario).dayOfYear())
data.push({ Horario: res[i].Horario });
return data;
});
};
module.exports = horariosDia;
@@ -1,25 +0,0 @@
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
const CarreraHorario = require(`${dbPath}/CarreraHorario`);
const Horario = require(`${dbPath}/Horario`);
const PrimerSemestre = require(`${dbPath}/PrimerSemestre`);
const monitor = async (body) => {
const data = [];
return CarreraHorario.findAll({
include: [{ model: Horario }, { model: Carrera }],
order: ['idHorario'],
}).then(async (res) => {
for (let i = 0; i < res.length; i++) {
const asistentes = await PrimerSemestre.findAll({
where: { idHorario: res[i].idHorario },
}).then((res) => res.length);
data.push({ CarreraHorario: res[i], asistentes });
}
return data;
});
};
module.exports = monitor;
-23
View File
@@ -1,23 +0,0 @@
const { Op } = require('sequelize');
const { validarId } = require('../../helper/validar');
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
const Grupo = require(`${dbPath}/Grupo`);
const get = async (body) => {
const idCarrera = validarId(body.idCarrera);
return Carrera.findOne({ where: { idCarrera } })
.then((res) => {
if (!res) throw new Error('No existe esta carrera.');
return Grupo.findAll({
where: { idCarrera, grupo: { [Op.like]: '11%' } },
});
})
.then((res) => {
for (let i = 0; i < res.length; i++) delete res[i].dataValues.idCarrera;
return res;
});
};
module.exports = get;
@@ -1,21 +0,0 @@
const moment = require('moment');
const dbPath = '../../db/tablas';
const GrupoHorario = require(`${dbPath}/GrupoHorario`);
const Horario = require(`${dbPath}/Horario`);
const hoy = moment();
const horariosDia = async (body) => {
const data = [];
return GrupoHorario.findAll({
include: [{ model: Horario }],
order: ['idHorario'],
}).then(async (res) => {
for (let i = 0; i < res.length; i++)
if (hoy.dayOfYear() === moment(res[i].Horario.horario).dayOfYear())
data.push({ Horario: res[i].Horario });
return data;
});
};
module.exports = horariosDia;
-29
View File
@@ -1,29 +0,0 @@
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 monitor = async (body) => {
const data = [];
return GrupoHorario.findAll({
include: [
{ model: Horario },
{ model: Grupo, include: [{ model: Carrera }] },
],
order: ['idHorario'],
}).then(async (res) => {
for (let i = 0; i < res.length; i++) {
const asistentes = await TercerSemestre.findAll({
where: { idGrupo: res[i].idGrupo, deseaAsistir: true },
}).then((res) => res.length);
data.push({ GrupoHorario: res[i], asistentes });
}
return data;
});
};
module.exports = monitor;
+22
View File
@@ -0,0 +1,22 @@
const { validarTexto } = require('../../helper/validar');
const Alumno = require(`../../db/tablas/Alumno`);
const Horario = require(`../../db/tablas/Horario`);
const get = async (body) => {
const turno = validarTexto(body.turno, 'El turno', 1);
return Horario.findAll({ where: { turno } }).then(async (res) => {
const data = [];
for (let i = 0; i < res.length; i++) {
const registrados = await Alumno.findAll({
where: { idHorario: res[i].idHorario },
});
if (registrados.length <= 50) data.push(res[i]);
}
return data;
});
};
module.exports = get;
@@ -1,30 +0,0 @@
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
const Grupo = require(`${dbPath}/Grupo`);
const PrimerSemestre = require(`${dbPath}/PrimerSemestre`);
const alumnosCarrera = async (body) => {
const data = [];
return Carrera.findAll().then(async (res) => {
for (let i = 0; i < res.length; i++) {
const alumnos = await PrimerSemestre.findAll({
include: [
{
model: Grupo,
where: { idCarrera: res[i].idCarrera },
},
],
}).then((res) => res.length);
data.push({
idCarrera: res[i].idCarrera,
carrera: res[i].carrera,
alumnos,
});
}
return data;
});
};
module.exports = alumnosCarrera;
@@ -1,32 +0,0 @@
const moment = require('moment');
const helperPath = '../../helper';
const { validarNumeroCuenta } = require(`${helperPath}/validar`);
const dbPath = '../../db/tablas';
const Horario = require(`${dbPath}/Horario`);
const PrimerSemestre = require(`${dbPath}/PrimerSemestre`);
const hoy = moment();
const asistencia = async (body) => {
const numeroCuenta = validarNumeroCuenta(body.numeroCuenta);
return PrimerSemestre.findOne({
where: { numeroCuenta },
include: [{ model: Horario }],
})
.then((res) => {
if (!res) throw new Error('No existe este alumno.');
if (hoy.dayOfYear() != moment(res.Horario.horario).dayOfYear())
throw new Error('Este alumno no tiene una cita para el día de hoy.');
if (res.asistio)
throw new Error('Ya fue registrada la asistencia de este alumno.');
return PrimerSemestre.update(
{ asistio: true },
{ where: { numeroCuenta } }
);
})
.then((res) => ({
message: 'Se registro correctamente la asistencia de este alumno.',
}));
};
module.exports = asistencia;
@@ -1,21 +0,0 @@
const helperPath = '../../helper';
const validar = require(`${helperPath}/validar`);
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
const Grupo = require(`${dbPath}/Grupo`);
const Horario = require(`${dbPath}/Horario`);
const PrimerSemestre = require(`${dbPath}/PrimerSemestre`);
const asistentes = async (body) => {
const idHorario = validar.validarId(body.idHorario);
return Horario.findOne({ where: { idHorario } }).then((res) => {
if (!res) throw new Error('No existe este horario.');
return PrimerSemestre.findAll({
where: { idHorario },
include: [{ model: Grupo, include: [{ model: Carrera }] }],
});
});
};
module.exports = asistentes;
-59
View File
@@ -1,59 +0,0 @@
const moment = require('moment');
const { convertArrayToCSV } = require('convert-array-to-csv');
const helperPath = '../../helper';
const helper = require(`${helperPath}/helper`);
const encriptar = require(`${helperPath}/encriptar`);
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
const Grupo = require(`${dbPath}/Grupo`);
const Horario = require(`${dbPath}/Horario`);
const PrimerSemestre = require(`${dbPath}/PrimerSemestre`);
const csv = async (body) => {
const path = `server/uploads/primer_semestre.csv`;
const data = [];
if (
!encriptar.comparar(
body.password,
'$2b$10$8FDx15tey9s9ITXNNE/Qourk1EfyrC6W8/ROqI0sGMuyOAuZ8oHMO'
)
)
throw new Error('Contraseña incorrecta.');
return PrimerSemestre.findAll({
include: [{ model: Grupo, include: [{ model: Carrera }] }],
})
.then(async (res) => {
for (let i = 0; i < res.length; i++) {
const horario = await Horario.findOne({
where: { idHorario: res[i].idHorario },
}).then((res) => moment(res.horario));
data.push({
numeroCuenta: res[i].numeroCuenta,
nombre: res[i].nombre,
carrera: res[i].Grupo.Carrera.carrera,
grupo: res[i].Grupo.grupo,
dia: `${
horario.date() < 10 ? '0' + horario.date() : horario.date()
}/${
horario.month() + 1 < 10
? '0' + (horario.month() + 1)
: horario.month() + 1
}/${horario.year()}`,
hora: `${
horario.hour() < 10 ? '0' + horario.hour() : horario.hour()
}:${
horario.minute() < 10 ? '0' + horario.minute() : horario.minute()
}`,
correo: res[i].correo,
asistio: res[i].asistio ? 'si' : 'no',
});
}
await helper.eliminarArchivo(path).catch((err) => {});
return helper.crearArchivo(path, convertArrayToCSV(data));
})
.then((res) => path);
};
module.exports = csv;
@@ -1,85 +0,0 @@
const helperPath = '../../helper';
const gmail = require(`${helperPath}/gmail`);
const correos = require(`${helperPath}/correos`);
const validar = require(`${helperPath}/validar`);
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
const CarreraHorario = require(`${dbPath}/CarreraHorario`);
const Horario = require(`${dbPath}/Horario`);
const Grupo = require(`${dbPath}/Grupo`);
const PrimerSemestre = require(`${dbPath}/PrimerSemestre`);
const registrar = async (body) => {
const idCarrera = validar.validarId(body.idCarrera);
const idGrupo = validar.validarId(body.idGrupo);
const idHorario = validar.validarId(body.idHorario);
const numeroCuenta = validar.validarNumeroCuenta(body.numeroCuenta);
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 },
});
})
.then((res) => {
if (!res) throw new Error('No existe este grupo.');
return Grupo.findOne({ where: { idGrupo, idCarrera } });
})
.then((res) => {
if (!res)
throw new Error('Este grupo no pertenece a la carrera indicada.');
if (res.grupo[0] === '2' && res.grupo[1] === '2')
throw new Error(
'Este grupo es de segundo semestre, no es valido para este registro.'
);
return Horario.findOne({ where: { idHorario } });
})
.then((res) => {
if (!res) throw new Error('No existe este horario.');
horario = res;
return CarreraHorario.findOne({ where: { idCarrera, idHorario } });
})
.then((res) => {
if (!res) throw new Error('Esta carrera no tiene asignado este horario.');
return PrimerSemestre.findOne({ where: { numeroCuenta } });
})
.then((res) => {
if (res) throw new Error('Ya se registro a este alumno al recorrido.');
return PrimerSemestre.findAll({
where: { idHorario },
});
})
.then((res) => {
if (res.length >= 45)
throw new Error('Este horario ya esta lleno, elige otro.');
return PrimerSemestre.create({
numeroCuenta,
correo,
nombre,
idHorario,
idGrupo,
});
})
.then((res) => {
mail = correos.correoPrimerSemestre(
res.numeroCuenta,
res.nombre,
carrera.carrera,
horario.horario
);
return gmail(mail.subject, res.correo, mail.message);
})
.then((res) => ({
message:
'Te has registrado correctamente, hemos mandado tu comprobante a tu correo.',
}));
};
module.exports = registrar;
@@ -1,31 +0,0 @@
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
const Grupo = require(`${dbPath}/Grupo`);
const TercerSemestre = require(`${dbPath}/TercerSemestre`);
const alumnosCarrera = async (body) => {
const data = [];
return Carrera.findAll().then(async (res) => {
for (let i = 0; i < res.length; i++) {
const alumnos = await TercerSemestre.findAll({
where: { deseaAsistir: true },
include: [
{
model: Grupo,
where: { idCarrera: res[i].idCarrera },
},
],
}).then((res) => res.length);
data.push({
idCarrera: res[i].idCarrera,
carrera: res[i].carrera,
alumnos,
});
}
return data;
});
};
module.exports = alumnosCarrera;
@@ -1,38 +0,0 @@
const moment = require('moment');
const helperPath = '../../helper';
const { validarNumeroCuenta } = require(`${helperPath}/validar`);
const dbPath = '../../db/tablas';
const GrupoHorario = require(`${dbPath}/GrupoHorario`);
const Horario = require(`${dbPath}/Horario`);
const TercerSemestre = require(`${dbPath}/TercerSemestre`);
const hoy = moment();
const asistencia = async (body) => {
const numeroCuenta = validarNumeroCuenta(body.numeroCuenta);
return TercerSemestre.findOne({
where: { numeroCuenta },
})
.then((res) => {
if (!res) throw new Error('No existe este alumno.');
if (res.asistio)
throw new Error('Ya fue registrada la asistencia de este alumno.');
return GrupoHorario.findOne({
where: { idGrupo: res.idGrupo },
include: [{ model: Horario }],
});
})
.then((res) => {
if (hoy.dayOfYear() != moment(res.Horario.horario).dayOfYear())
throw new Error('Este alumno no tiene una cita para el día de hoy.');
return TercerSemestre.update(
{ asistio: true },
{ where: { numeroCuenta } }
);
})
.then((res) => ({
message: 'Se registro correctamente la asistencia de este alumno.',
}));
};
module.exports = asistencia;
@@ -1,30 +0,0 @@
const helperPath = '../../helper';
const validar = 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 asistentes = async (body) => {
const idHorario = validar.validarId(body.idHorario);
return Horario.findOne({ where: { idHorario } })
.then((res) => {
if (!res) throw new Error('No existe este horario.');
return GrupoHorario.findOne({
where: { idHorario },
});
})
.then((res) => {
if (!res)
throw new Error('No hay un grupo que tenga asignado este horario.');
return TercerSemestre.findAll({
where: { idGrupo: res.idGrupo, deseaAsistir: true },
include: [{ model: Grupo, include: [{ model: Carrera }] }],
});
});
};
module.exports = asistentes;
-61
View File
@@ -1,61 +0,0 @@
const { convertArrayToCSV } = require('convert-array-to-csv');
const moment = require('moment');
const helperPath = '../../helper';
const helper = require(`${helperPath}/helper`);
const encriptar = require(`${helperPath}/encriptar`);
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 csv = async (body) => {
const path = `server/uploads/tercer_semestre.csv`;
const data = [];
if (
!encriptar.comparar(
body.password,
'$2b$10$8FDx15tey9s9ITXNNE/Qourk1EfyrC6W8/ROqI0sGMuyOAuZ8oHMO'
)
)
throw new Error('Contraseña incorrecta.');
return TercerSemestre.findAll({
where: { deseaAsistir: true },
include: [{ model: Grupo, include: [{ model: Carrera }] }],
})
.then(async (res) => {
for (let i = 0; i < res.length; i++) {
const horario = await GrupoHorario.findOne({
where: { idGrupo: res[i].idGrupo },
include: [{ model: Horario }],
}).then((res) => moment(res.Horario.horario));
data.push({
numeroCuenta: res[i].numeroCuenta,
nombre: res[i].nombre,
carrera: res[i].Grupo.Carrera.carrera,
grupo: res[i].Grupo.grupo,
dia: `${
horario.date() < 10 ? '0' + horario.date() : horario.date()
}/${
horario.month() + 1 < 10
? '0' + (horario.month() + 1)
: horario.month() + 1
}/${horario.year()}`,
hora: `${
horario.hour() < 10 ? '0' + horario.hour() : horario.hour()
}:${
horario.minute() < 10 ? '0' + horario.minute() : horario.minute()
}`,
asistio: res[i].asistio ? 'si' : 'no',
});
}
await helper.eliminarArchivo(path).catch((err) => {});
return helper.crearArchivo(path, convertArrayToCSV(data));
})
.then((res) => path);
};
module.exports = csv;
-36
View File
@@ -1,36 +0,0 @@
const { validarNumeroCuenta } = require('../../helper/validar');
const dbPath = '../../db/tablas';
const Carrera = require(`${dbPath}/Carrera`);
const Grupo = require(`${dbPath}/Grupo`);
const Horario = require(`${dbPath}/Horario`);
const GrupoHorario = require(`${dbPath}/GrupoHorario`);
const TercerSemestre = require(`${dbPath}/TercerSemestre`);
const get = async (body) => {
const numeroCuenta = validarNumeroCuenta(body.numeroCuenta);
let alumnoTercerSemestre = {};
return TercerSemestre.findOne({
where: { numeroCuenta },
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.');
alumnoTercerSemestre = res;
delete alumnoTercerSemestre.dataValues.idGrupo;
delete alumnoTercerSemestre.dataValues.Grupo.dataValues.idCarrera;
return GrupoHorario.findOne({
where: { idGrupo: alumnoTercerSemestre.Grupo.idGrupo },
include: [{ model: Horario }],
});
})
.then((res) => {
delete res.dataValues.idHorario;
delete res.dataValues.idGrupo;
return { alumnoTercerSemestre, GrupoHorario: res };
});
};
module.exports = get;
@@ -1,57 +0,0 @@
const helperPath = '../../helper';
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 registrar = async (body) => {
const idTercerSemestre = validarId(body.idTercerSemestre);
let alumno = {};
let mail = {};
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.');
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',
// `${res.numeroCuenta}@pcpuma.acatlan.unam.mx`
mail.message
);
})
.then((res) =>
TercerSemestre.update(
{ deseaAsistir: true },
{ where: { idTercerSemestre } }
)
)
.then((res) => ({
message:
'Te has registrado correctamente, hemos mandado tu comprobante a tu correo pcpuma.',
}));
};
module.exports = registrar;
+29 -21
View File
@@ -1,37 +1,45 @@
const csv = require('csvtojson');
const { Op } = require('sequelize');
const dbPath = './tablas';
const Carrera = require(`${dbPath}/Carrera`);
const Grupo = require(`${dbPath}/Grupo`);
const TercerSemestre = require(`${dbPath}/TercerSemestre`);
const Alumno = require(`${dbPath}/Alumno`);
const cargaMasiva = async () => {
const path = `server/db/alumnos_segundo.csv`;
const path = `server/db/generacion2021.csv`;
await csv()
.fromFile(path)
.then(async (alumnos) => {
for (let i = 0; i < alumnos.length; i++) {
// for (let i = 0; i < 1; i++) {
const grupo = await Grupo.findOne({
where: { grupo: alumnos[i].grupo },
include: [{ model: Carrera, where: { carrera: alumnos[i].carrera } }],
const carrera = await Carrera.findOne({
where: { carrera: alumnos[i].nombreCarrera },
}).then((res) => {
if (!res)
return Carrera.create({ carrera: alumnos[i].nombreCarrera });
return res;
});
if (!grupo) {
console.log(
`No exite la carrera o el grupo del alumno ${alumnos[i].cuenta}.`
);
continue;
}
await TercerSemestre.create({
numeroCuenta: alumnos[i].cuenta,
nombre: alumnos[i].nombre,
idGrupo: grupo.idGrupo,
await Alumno.findOne({
where: { numeroCuenta: alumnos[i].numeroCuenta },
}).then(async (res) => {
if (res)
console.log(
`El alumno ${alumnos[i].numeroCuenta} ya existe. Linea ${i + 2}.`
);
else {
await Alumno.create({
numeroCuenta: alumnos[i].numeroCuenta,
turno: alumnos[i].turno,
idCarrera: carrera.idCarrera,
}).then((res) => {
console.log(
`Se creo al alumno ${res.numeroCuenta} correctamente. Linea ${
i + 2
}.`
);
if (alumnos[i].inscrito != 'SI') console.log(`No esta inscrito.`);
});
}
});
console.log(
`Se añadio al alumno ${alumnos[i].cuenta} al grupo ${grupo.grupo} con id ${grupo.idGrupo}.`
);
}
});
};
+16 -340
View File
@@ -1,32 +1,14 @@
require('../config/config');
const { Op } = require('sequelize');
const moment = require('moment');
const colors = require('colors');
const Carrera = require('./tablas/Carrera');
const CarreraHorario = require('./tablas/CarreraHorario');
const Grupo = require('./tablas/Grupo');
const GrupoHorario = require('./tablas/GrupoHorario');
const Horario = require('./tablas/Horario');
const PrimerSemestre = require('./tablas/PrimerSemestre');
const TercerSemestre = require('./tablas/TercerSemestre');
const Alumno = require('./tablas/Alumno');
const drop = async () => {
console.log('\nPaso 1) Desinstalando la db.'.bold.blue);
await TercerSemestre.drop();
console.log('La tabla TercerSemestre se desinstalo correctamente.'.magenta);
await PrimerSemestre.drop();
console.log('La tabla PrimerSemestre se desinstalo correctamente.'.magenta);
await GrupoHorario.drop();
console.log('La tabla GrupoHorario se desinstalo correctamente.'.magenta);
await CarreraHorario.drop();
console.log('La tabla CarreraHorario se desinstalo correctamente.'.magenta);
await Grupo.drop();
console.log('La tabla Grupo se desinstalo correctamente.'.magenta);
await Alumno.drop();
console.log('La tabla Alumno se desinstalo correctamente.'.magenta);
await Horario.drop();
console.log('La tabla Horario se desinstalo correctamente.'.magenta);
@@ -44,255 +26,32 @@ const sync = async () => {
await Horario.sync();
console.log('La tabla Horario se instalo correctamente.'.magenta);
await Grupo.sync();
console.log('La tabla Grupo se instalo correctamente.'.magenta);
await CarreraHorario.sync();
console.log('La tabla CarreraHorario se instalo correctamente.'.magenta);
await GrupoHorario.sync();
console.log('La tabla GrupoHorario se instalo correctamente.'.magenta);
await PrimerSemestre.sync();
console.log('La tabla PrimerSemestre se instalo correctamente.'.magenta);
await TercerSemestre.sync();
console.log('La tabla TercerSemestre se instalo correctamente.'.magenta);
};
const data = [
{
carrera: 'ACTUARÍA',
matutino: 4,
despertino: 3,
horarioAsignado: { dia: '2021/08/12', horaInicio: '08:00' },
horariosAsignados: [{ dia: '2021/08/06', horaInicio: '08:00', turnos: 7 }],
},
{
carrera: 'ARQUITECTURA',
matutino: 4,
despertino: 3,
horarioAsignado: { dia: '2021/08/10', horaInicio: '10:40' },
horariosAsignados: [{ dia: '2021/08/03', horaInicio: '10:40', turnos: 7 }],
},
{
carrera: 'CIENCIAS POLÍTICAS Y ADMON. PÚBLICA',
matutino: 3,
despertino: 2,
horarioAsignado: { dia: '2021/08/12', horaInicio: '13:00' },
horariosAsignados: [{ dia: '2021/08/06', horaInicio: '13:00', turnos: 5 }],
},
{
carrera: 'COMUNICACIÓN',
matutino: 4,
despertino: 4,
horarioAsignado: { dia: '2021/08/11', horaInicio: '08:00' },
horariosAsignados: [{ dia: '2021/08/04', horaInicio: '08:00', turnos: 8 }],
},
{
carrera: 'DERECHO',
matutino: 9,
despertino: 9,
horarioAsignado: { dia: '2021/08/09', horaInicio: '08:00' },
horariosAsignados: [{ dia: '2021/08/02', horaInicio: '08:00', turnos: 18 }],
},
{
carrera: 'DISEÑO GRÁFICO',
matutino: 4,
despertino: 4,
horarioAsignado: { dia: '2021/08/10', horaInicio: '08:00' },
horariosAsignados: [{ dia: '2021/08/03', horaInicio: '08:00', turnos: 8 }],
},
{
carrera: 'ECONOMÍA',
matutino: 3,
despertino: 2,
horarioAsignado: { dia: '2021/08/13', horaInicio: '08:00' },
horariosAsignados: [
{ dia: '2021/08/04', horaInicio: '15:20', turnos: 1 },
{ dia: '2021/08/05', horaInicio: '08:00', turnos: 4 },
],
},
{
carrera: 'ENSEÑANZA DE INGLÉS',
matutino: 1,
despertino: 1,
horarioAsignado: { dia: '2021/08/11', horaInicio: '15:00' },
horariosAsignados: [{ dia: '2021/08/04', horaInicio: '15:00', turnos: 1 }],
},
{
carrera: 'FILOSOFÍA',
matutino: 1,
despertino: 1,
horarioAsignado: { dia: '2021/08/11', horaInicio: '12:40' },
horariosAsignados: [{ dia: '2021/08/04', horaInicio: '12:40', turnos: 2 }],
},
{
carrera: 'HISTORIA',
matutino: 2,
despertino: 1,
horarioAsignado: { dia: '2021/08/11', horaInicio: '14:00' },
horariosAsignados: [{ dia: '2021/08/04', horaInicio: '14:00', turnos: 3 }],
},
{
carrera: 'INGENIERÍA CIVIL',
matutino: 3,
despertino: 2,
horarioAsignado: { dia: '2021/08/09', horaInicio: '14:00' },
horariosAsignados: [{ dia: '2021/08/02', horaInicio: '14:00', turnos: 5 }],
},
{
carrera: 'LENGUA Y LITERATURA HISPÁNICAS',
matutino: 1,
despertino: 1,
horarioAsignado: { dia: '2021/08/11', horaInicio: '13:20' },
horariosAsignados: [{ dia: '2021/08/04', horaInicio: '13:20', turnos: 2 }],
},
{
carrera: 'MATEMÁTICAS. APL. Y COMP. (1999)',
matutino: 4,
despertino: 4,
horarioAsignado: { dia: '2021/08/12', horaInicio: '10:20' },
horariosAsignados: [{ dia: '2021/08/06', horaInicio: '10:20', turnos: 8 }],
},
{
carrera: 'PEDAGOGÍA',
matutino: 4,
despertino: 2,
horarioAsignado: { dia: '2021/08/11', horaInicio: '10:40' },
horariosAsignados: [{ dia: '2021/08/04', horaInicio: '10:40', turnos: 6 }],
},
{
carrera: 'RELACIONES INTERNACIONALES',
matutino: 3,
despertino: 3,
horarioAsignado: { dia: '2021/08/10', horaInicio: '13:00' },
horariosAsignados: [{ dia: '2021/08/03', horaInicio: '13:00', turnos: 6 }],
},
{
carrera: 'SOCIOLOGÍA',
matutino: 2,
despertino: 2,
horarioAsignado: { dia: '2021/08/13', horaInicio: '09:40' },
horariosAsignados: [
{ dia: '2021/08/03', horaInicio: '15:00', turnos: 2 },
{ dia: '2021/08/06', horaInicio: '14:40', turnos: 2 },
],
},
// {
// carrera: 'DERECHO (SUA)',
// matutino: 0,
// despertino: 0,
// horarioAsignado:{dia:'',horaInicio:''}
// },
// {
// carrera: 'ENSEÑANZA DE ESPAÑOL(LENG EXTRANJERA)SUA',
// matutino: 0,
// despertino: 0,
// horarioAsignado:{dia:'',horaInicio:''}
// },
// {
// carrera: 'ENSEÑANZA DE FRANCES(LENG EXTRANJERA)SUA',
// matutino: 0,
// despertino: 0,
// horarioAsignado:{dia:'',horaInicio:''}
// },
// {
// carrera: 'ENSEÑANZA DE INGLES (LENG EXTRANJERA)SUA',
// matutino: 0,
// despertino: 0,
// horarioAsignado:{dia:'',horaInicio:''}
// },
// {
// carrera: 'ENSEÑANZA DE ITALIANO(LENG EXTRANJ.)SUA',
// matutino: 0,
// despertino: 0,
// horarioAsignado:{dia:'',horaInicio:''}
// },
// {
// carrera: 'RELACIONES INTERNACIONALES (SUA)',
// matutino: 0,
// despertino: 0,
// horarioAsignado:{dia:'',horaInicio:''}
// },
];
const dataCarrera = async () => {
console.log('\nPaso 3) Instalando catalogo Carrera.'.bold.blue);
for (let i = 0; i < data.length; i++) {
await Carrera.create({ carrera: data[i].carrera });
console.log(
`Se agrego la carrera ${data[i].carrera} correctamente.`.magenta
);
}
};
const dataGrupo = async () => {
console.log('\nPaso 4) Instalando catalogo Grupo.'.bold.blue);
for (let i = 0; i < data.length; i++) {
for (let j = 1; j <= data[i].matutino; j++) {
const grupo = `110${j}`;
await Grupo.create({ grupo, idCarrera: i + 1 });
console.log(
`Se agrego el grupo ${grupo} a la carrera ${data[i].carrera} correctamente.`
.magenta
);
}
console.log();
for (let j = 1; j <= data[i].despertino; j++) {
const grupo = `115${j}`;
await Grupo.create({ grupo, idCarrera: i + 1 });
console.log(
`Se agrego el grupo ${grupo} a la carrera ${data[i].carrera} correctamente.`
.magenta
);
}
console.log();
for (let j = 1; j <= data[i].matutino; j++) {
const grupo = `220${j}`;
await Grupo.create({ grupo, idCarrera: i + 1 });
console.log(
`Se agrego el grupo ${grupo} a la carrera ${data[i].carrera} correctamente.`
.magenta
);
}
console.log();
for (let j = 1; j <= data[i].despertino; j++) {
const grupo = `225${j}`;
await Grupo.create({ grupo, idCarrera: i + 1 });
console.log(
`Se agrego el grupo ${grupo} a la carrera ${data[i].carrera} correctamente.`
.magenta
);
}
console.log('\n');
}
await Alumno.sync();
console.log('La tabla Alumno se instalo correctamente.'.magenta);
};
const dataHorario = async () => {
const diaFin = 13;
const diaInicio = 2;
const diaInicio = 16;
const diaFin = 22;
console.log('\nPaso 5) Instalando catalogo Horario.'.bold.blue);
console.log('\nPaso 3) Instalando catalogo Horario.'.bold.blue);
for (let i = diaInicio; i <= diaFin; i++) {
const dia = `2021/08/${i < 10 ? '0' + i : i}`;
const horaFin = 15;
const minutoFin = 20;
let horaInicio = 8;
const dia = `2021/11/${i < 10 ? '0' + i : i}`;
const horaFin = 17;
const minutoFin = 0;
let horaInicio = 10;
let minutoInicio = 0;
let parar = false;
let turno = 'V';
if (i === 7 || i === 8) continue;
if (i === 20 || i === 21) continue;
while (!parar) {
const hora = `${horaInicio < 10 ? '0' + horaInicio : horaInicio}:${
minutoInicio < 10 ? '0' + minutoInicio : minutoInicio
}`;
await Horario.create({ horario: `${dia} ${hora}` });
if (horaInicio === 13 && minutoInicio === 40) turno = 'M';
await Horario.create({ horario: `${dia} ${hora}`, turno });
console.log(`Se agrego el horario ${dia} ${hora} correctamente.`.magenta);
if (horaInicio === horaFin && minutoInicio === minutoFin) parar = true;
else {
@@ -306,93 +65,10 @@ const dataHorario = async () => {
}
};
const dataGrupoHorario = async () => {
console.log('\nPaso 6) Instalando catalogo GrupoHorario.'.bold.blue);
for (let i = 0; i < data.length; i++) {
const gruposCarrera = await Grupo.findAll({
where: { grupo: { [Op.like]: '22%' }, idCarrera: i + 1 },
});
let idHorario = await Horario.findOne({
where: {
horario: new Date(
`${data[i].horarioAsignado.dia} ${data[i].horarioAsignado.horaInicio}`
),
},
}).then((res) => res.idHorario);
for (let j = 0; j < gruposCarrera.length; j++) {
await GrupoHorario.create({
idHorario,
idGrupo: gruposCarrera[j].idGrupo,
})
.then((res) =>
GrupoHorario.findOne({
where: { idGrupoHorario: res.idGrupoHorario },
include: [
{ model: Grupo, include: [{ model: Carrera }] },
{ model: Horario },
],
})
)
.then((res) => {
console.log(
`Se le asigno al grupo ${res.Grupo.grupo} de la carrera ${
res.Grupo.Carrera.carrera
} el horario ${moment(res.Horario.horario).format()}`.magenta
);
idHorario++;
});
}
console.log();
}
};
const dataCarreraHorario = async () => {
console.log('\nPaso 7) Instalando catalogo CarreraHorario.'.bold.blue);
for (let i = 0; i < data.length; i++) {
for (let j = 0; j < data[i].horariosAsignados.length; j++) {
let idHorario = await Horario.findOne({
where: {
horario: new Date(
`${data[i].horariosAsignados[j].dia} ${data[i].horariosAsignados[j].horaInicio}`
),
},
}).then((res) => res.idHorario);
for (let k = 0; k < data[i].horariosAsignados[j].turnos; k++) {
await CarreraHorario.create({
idHorario,
idCarrera: i + 1,
})
.then((res) =>
CarreraHorario.findOne({
where: { idCarreraHorario: res.idCarreraHorario },
include: [{ model: Carrera }, { model: Horario }],
})
)
.then((res) => {
console.log(
`Se le asigno a la carrera ${
res.Carrera.carrera
} el horario ${moment(res.Horario.horario).format()}`.magenta
);
idHorario++;
});
}
}
console.log();
}
};
const exe = async () => {
await drop();
await sync();
await dataCarrera();
await dataGrupo();
await dataHorario();
await dataGrupoHorario();
await dataCarreraHorario();
console.log(
'\nSe ha instalado exitosamente la base de datos.\n'.underline.bold.green
@@ -1,12 +1,12 @@
const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
const Carrera = require('./Carrera');
const Horario = require('./Horario');
const Grupo = require('./Grupo');
class PrimerSemestre extends Model {}
PrimerSemestre.init(
class Alumno extends Model {}
Alumno.init(
{
idPrimerSemestre: {
idAlumno: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
@@ -18,38 +18,33 @@ PrimerSemestre.init(
allowNull: false,
unique: true,
},
nombre: {
type: DataTypes.STRING(70),
allowNull: false,
},
correo: {
type: DataTypes.STRING(60),
turno: {
type: DataTypes.STRING(1),
allowNull: false,
},
asistio: {
type: DataTypes.BOOLEAN,
allowNull: true,
defaultValue: null,
allowNull: false,
defaultValue: false,
},
},
{
sequelize,
modelName: 'PrimerSemestre',
tableName: 'primer_semestre',
modelName: 'Alumno',
tableName: 'alumno',
timestamps: false,
}
);
PrimerSemestre.belongsTo(Grupo, {
Alumno.belongsTo(Carrera, {
foreignKey: {
name: 'idGrupo',
name: 'idCarrera',
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
allowNull: false,
},
});
PrimerSemestre.belongsTo(Horario, {
Alumno.belongsTo(Horario, {
foreignKey: {
name: 'idHorario',
type: DataTypes.INTEGER,
@@ -58,4 +53,4 @@ PrimerSemestre.belongsTo(Horario, {
},
});
module.exports = PrimerSemestre;
module.exports = Alumno;
-41
View File
@@ -1,41 +0,0 @@
const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
const Carrera = require('./Carrera');
const Horario = require('./Horario');
class CarreraHorario extends Model {}
CarreraHorario.init(
{
idCarreraHorario: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
unique: true,
autoIncrement: true,
},
},
{
sequelize,
modelName: 'CarreraHorario',
tableName: 'carrera_horario',
timestamps: false,
}
);
CarreraHorario.belongsTo(Horario, {
foreignKey: {
name: 'idHorario',
type: DataTypes.INTEGER,
allowNull: false,
},
});
CarreraHorario.belongsTo(Carrera, {
foreignKey: {
name: 'idCarrera',
type: DataTypes.INTEGER,
allowNull: false,
},
});
module.exports = CarreraHorario;
-36
View File
@@ -1,36 +0,0 @@
const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
const Carrera = require('./Carrera');
class Grupo extends Model {}
Grupo.init(
{
idGrupo: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
unique: true,
autoIncrement: true,
},
grupo: {
type: DataTypes.STRING(4),
allowNull: false,
},
},
{
sequelize,
modelName: 'Grupo',
tableName: 'grupo',
timestamps: false,
}
);
Grupo.belongsTo(Carrera, {
foreignKey: {
name: 'idCarrera',
type: DataTypes.INTEGER,
allowNull: false,
},
});
module.exports = Grupo;
-41
View File
@@ -1,41 +0,0 @@
const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
const Horario = require('./Horario');
const Grupo = require('./Grupo');
class GrupoHorario extends Model {}
GrupoHorario.init(
{
idGrupoHorario: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
unique: true,
autoIncrement: true,
},
},
{
sequelize,
modelName: 'GrupoHorario',
tableName: 'grupo_horario',
timestamps: false,
}
);
GrupoHorario.belongsTo(Horario, {
foreignKey: {
name: 'idHorario',
type: DataTypes.INTEGER,
allowNull: false,
},
});
GrupoHorario.belongsTo(Grupo, {
foreignKey: {
name: 'idGrupo',
type: DataTypes.INTEGER,
allowNull: false,
},
});
module.exports = GrupoHorario;
+4
View File
@@ -15,6 +15,10 @@ Horario.init(
type: DataTypes.DATE,
allowNull: false,
},
turno: {
type: DataTypes.STRING(1),
allowNull: false,
},
},
{
sequelize,
-51
View File
@@ -1,51 +0,0 @@
const { DataTypes, Model } = require('sequelize');
const sequelize = require('../../config/sequelize.conf');
const Grupo = require('./Grupo');
class TercerSemestre extends Model {}
TercerSemestre.init(
{
idTercerSemestre: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
unique: true,
autoIncrement: true,
},
numeroCuenta: {
type: DataTypes.STRING(10),
allowNull: false,
unique: true,
},
nombre: {
type: DataTypes.STRING(70),
allowNull: false,
},
deseaAsistir: {
type: DataTypes.BOOLEAN,
allowNull: true,
defaultValue: null,
},
asistio: {
type: DataTypes.BOOLEAN,
allowNull: true,
defaultValue: null,
},
},
{
sequelize,
modelName: 'TercerSemestre',
tableName: 'tercer_semestre',
timestamps: false,
}
);
TercerSemestre.belongsTo(Grupo, {
foreignKey: {
name: 'idGrupo',
type: DataTypes.INTEGER,
allowNull: false,
},
});
module.exports = TercerSemestre;
+13 -73
View File
@@ -1,80 +1,11 @@
const moment = require('moment');
const correoPrimerSemestre = (numeroCuenta, nombre, lic, date) => {
const correoAlumno = (numeroCuenta, lic, date, idAlumno) => {
const fecha = moment(date);
return {
subject: `Comprobante de registro recorrido.`,
message: `<h2>Estimada(o) ${nombre}</h2>
<h3><b>Alumna(o) de la Generación 2022</b>,<br>Licenciatura: <b>${lic}</b></h3>
<div style="font-size: 15px;">
<p>
El objetivo de esta actividad (no obligatoria) es realizar un recorrido por la FES Acatlán, tu Facultad, a
efecto de que conozcas los pasillos, salones, espacios e instalaciones que estarán a tu disposición
cuando sea seguro para todas y todos.
</p>
<p>
Te esperamos en la entrada peatonal de la Facultad (sobre Av. San Juan Totoltepec), el próximo <b>${
fecha.date() < 10 ? '0' + fecha.date() : fecha.date()
}/${
fecha.month() + 1 < 10 ? '0' + (fecha.month() + 1) : fecha.month() + 1
}/${fecha.year()}</b> a las <b>${
fecha.hour() < 10 ? '0' + fecha.hour() : fecha.hour()
}:${fecha.minute() < 10 ? '0' + fecha.minute() : fecha.minute()} h</b>.
</p>
<p>
Te pedimos asistir en la fecha y hora que elegiste (no es posible hacer cambios), además es
importante atender las siguientes medidas:
</p>
<p>
⮚ Programa tu llegada 10 min. antes de la hora de tu cita.
</p>
<p>
⮚ El uso de cubrebocas es obligatorio en todo momento.
</p>
<p>
⮚ Presenta al ingreso este “Comprobante de registro para recorrido”, puede ser en formato impreso o digital.
</p>
<p>
⮚ No se permitirán acompañantes durante el recorrido.
</p>
<p>
⮚ Acude con ropa cómoda y agua para estar bien hidratada(o).
</p>
<p>
⮚ Si acudes en auto, sólo se permitirá tu ingreso (sin acompañantes) por el acceso vehicular sobre la avenida San Juan Totoltepec, junto a la Plaza San Mateo.
</p>
<p>
¡Estaremos felices de recibirte!
</p>
<img src="https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=https://api.qrserver.com/v1/create-qr-code/?size=200x200&data={%22numeroCuenta%22:%22${numeroCuenta}%22}" alt="qr_img" />
<p><i>"Por mi raza hablará el espíritu"</i></p>
<p><b><i>Facultad de Estudios Superiores Acatlán</i></b></p>
</div>
`,
};
};
const correoTercerSemestre = (numeroCuenta, nombre, lic, date) => {
const fecha = moment(date);
return {
subject: `Comprobante de registro recorrido.`,
message: `<h2>Estimada(o) ${nombre}</h2>
message: `<h2>Estimada(o) alumna(o)</h2>
<h3><b>Alumna(o) de la Generación 2021</b>,<br>Licenciatura: <b>${lic}</b></h3>
<div style="font-size: 15px;">
@@ -122,7 +53,7 @@ const correoTercerSemestre = (numeroCuenta, nombre, lic, date) => {
¡Estaremos felices de recibirte!
</p>
<img src="https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=https://api.qrserver.com/v1/create-qr-code/?size=200x200&data={%22numeroCuenta%22:%22${numeroCuenta}%22}" alt="qr_img" />
<img src="https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=https://api.qrserver.com/v1/create-qr-code/?size=200x200&data={%22numeroCuenta%22:%22${numeroCuenta}%22,%22idAlumno%22:${idAlumno}}" alt="qr_img" />
<p><i>"Por mi raza hablará el espíritu"</i></p>
@@ -132,4 +63,13 @@ const correoTercerSemestre = (numeroCuenta, nombre, lic, date) => {
};
};
module.exports = { correoPrimerSemestre, correoTercerSemestre };
const correoAsistencia = (numeroCuenta, lic, date) => {
// const fecha = moment(date);
return {
subject: `Comprobante de asistencia recorrido.`,
message: `Asistencia uwu.`,
};
};
module.exports = { correoAlumno, correoAsistencia };
@@ -1,10 +1,32 @@
const express = require('express');
const app = express();
const route = '/carrera_horario';
const controllerPath = '../controller/CarreraHorario';
const route = '/alumno';
const controllerPath = '../controller/Alumno';
const get = require(`${controllerPath}/get`);
const horariosDia = require(`${controllerPath}/horariosDia`);
const monitor = require(`${controllerPath}/monitor`);
const registrar = require(`${controllerPath}/registrar`);
const pasarLista = require(`${controllerPath}/pasarLista`);
// PUT
app.put(`${route}/registrar`, (req, res) => {
return registrar(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
app.put(`${route}/pasar_lista`, (req, res) => {
return pasarLista(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
// GET
app.get(`${route}`, (req, res) => {
@@ -17,18 +39,8 @@ app.get(`${route}`, (req, res) => {
});
});
app.get(`${route}/horarios_dia`, (req, res) => {
return horariosDia(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
app.get(`${route}/monitor`, (req, res) => {
return monitor(req.body)
return monitor()
.then((data) => {
res.status(200).json(data);
})
-17
View File
@@ -1,17 +0,0 @@
const express = require('express');
const app = express();
const route = '/carrera';
const controllerPath = '../controller/Carrera';
const get = require(`${controllerPath}/get`);
app.get(`${route}`, (req, res) => {
return get()
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
module.exports = app;
-29
View File
@@ -1,29 +0,0 @@
const express = require('express');
const app = express();
const route = '/grupo_horario';
const controllerPath = '../controller/GrupoHorario';
const horariosDia = require(`${controllerPath}/horariosDia`);
const monitor = require(`${controllerPath}/monitor`);
// GET
app.get(`${route}/horarios_dia`, (req, res) => {
return horariosDia(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
app.get(`${route}/monitor`, (req, res) => {
return monitor(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
module.exports = app;
@@ -1,9 +1,10 @@
const express = require('express');
const app = express();
const route = '/grupo';
const controllerPath = '../controller/Grupo';
const route = '/horario';
const controllerPath = '../controller/Horario';
const get = require(`${controllerPath}/get`);
// GET
app.get(`${route}`, (req, res) => {
return get(req.query)
.then((data) => {
-64
View File
@@ -1,64 +0,0 @@
const express = require('express');
const app = express();
const route = '/primer_semestre';
const controllerPath = '../controller/PrimerSemestre';
const alumnosCarrera = require(`${controllerPath}/alumnosCarrera`);
const asistencia = require(`${controllerPath}/asistencia`);
const asistentes = require(`${controllerPath}/asistentes`);
const csv = require(`${controllerPath}/csv`);
const registrar = require(`${controllerPath}/registrar`);
// POST
app.post(`${route}/csv`, (req, res) => {
return csv(req.body)
.then((data) => {
res.download(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
app.post(`${route}/registrar`, (req, res) => {
return registrar(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
// PUT
app.put(`${route}/asistencia`, (req, res) => {
return asistencia(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
// GET
app.get(`${route}/asistentes`, (req, res) => {
return asistentes(req.query)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
app.get(`${route}/alumnos_carrera`, (req, res) => {
return alumnosCarrera(req.query)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
module.exports = app;
-75
View File
@@ -1,75 +0,0 @@
const express = require('express');
const app = express();
const route = '/tercer_semestre';
const controllerPath = '../controller/TercerSemestre';
const alumnosCarrera = require(`${controllerPath}/alumnosCarrera`);
const asistencia = require(`${controllerPath}/asistencia`);
const asistentes = require(`${controllerPath}/asistentes`);
const csv = require(`${controllerPath}/csv`);
const get = require(`${controllerPath}/get`);
const registrar = require(`${controllerPath}/registrar`);
// POST
app.post(`${route}/csv`, (req, res) => {
return csv(req.body)
.then((data) => {
res.download(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
//PUT
app.put(`${route}/registrar`, (req, res) => {
return registrar(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
app.put(`${route}/asistencia`, (req, res) => {
return asistencia(req.body)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
// GET
app.get(`${route}`, (req, res) => {
return get(req.query)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
app.get(`${route}/asistentes`, (req, res) => {
return asistentes(req.query)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
app.get(`${route}/alumnos_carrera`, (req, res) => {
return alumnosCarrera(req.query)
.then((data) => {
res.status(200).json(data);
})
.catch((err) => {
res.status(400).json({ message: err.message });
});
});
module.exports = app;
+2 -6
View File
@@ -1,11 +1,7 @@
const express = require('express');
const app = express();
app.use(require('./Carrera'));
app.use(require('./CarreraHorario'));
app.use(require('./Grupo'));
app.use(require('./GrupoHorario'));
app.use(require('./PrimerSemestre'));
app.use(require('./TercerSemestre'));
app.use(require('./Alumno'));
app.use(require('./Horario'));
module.exports = app;