primer semestre listo
This commit is contained in:
@@ -15,14 +15,9 @@ const get = async (body) => {
|
||||
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 = {};
|
||||
|
||||
/*
|
||||
Falta
|
||||
Enviar correo con qr de confirmación de su registro a su
|
||||
email
|
||||
*/
|
||||
|
||||
return Carrera.findOne({ where: { idCarrera } })
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('No existe esta carrera.');
|
||||
@@ -63,12 +58,13 @@ const get = async (body) => {
|
||||
return PrimerSemestre.create({
|
||||
numeroCuenta,
|
||||
correo,
|
||||
nombre,
|
||||
idHorario,
|
||||
idGrupo,
|
||||
});
|
||||
})
|
||||
.then((res) => {
|
||||
mail = correo = correos(res.nombre, res.numeroCuenta);
|
||||
mail = correos(res.nombre, res.numeroCuenta);
|
||||
gmail(mail.subject, res.correo, mail.message);
|
||||
})
|
||||
.then((res) => ({
|
||||
|
||||
@@ -18,6 +18,10 @@ PrimerSemestre.init(
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
},
|
||||
nombre: {
|
||||
type: DataTypes.STRING(70),
|
||||
allowNull: false,
|
||||
},
|
||||
correo: {
|
||||
type: DataTypes.STRING(60),
|
||||
allowNull: false,
|
||||
|
||||
@@ -9,7 +9,7 @@ const gmail = (subject, to, html) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
send({ subject, to, html }, (error, result, fullResult) => {
|
||||
if (error) reject(error);
|
||||
console.log(fullResult);
|
||||
// console.log(fullResult);
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user