validar sin ticket
This commit is contained in:
@@ -1,9 +1,23 @@
|
||||
const dbPath = '../../db/tablas';
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const {
|
||||
validarNumeroEntero,
|
||||
validarNumeroCuenta,
|
||||
} = require('../../helper/validar');
|
||||
const correoInscripcion = require('../../helper/correo');
|
||||
|
||||
const validarSinTicket = async (body) => {
|
||||
const numeroCuenta = validarNumeroCuenta(
|
||||
body.numeroCuenta,
|
||||
'número de cuenta',
|
||||
true
|
||||
);
|
||||
const idUsuario = validarNumeroEntero(body.idUsuario, 'usuario', true);
|
||||
const idArea = validarNumeroEntero(body.idArea, 'IDAREA', true);
|
||||
|
||||
let correo = {};
|
||||
let email = '';
|
||||
|
||||
return Inscripcion.update(
|
||||
{
|
||||
validacion: 1,
|
||||
@@ -14,11 +28,17 @@ const validarSinTicket = async (body) => {
|
||||
},
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
email = `${numeroCuenta}@pcpuma.acatlan.unam.mx`;
|
||||
usuarioInscrito(numeroCuenta, idArea);
|
||||
correo = correoInscripcion();
|
||||
gmail(correo.subject, email, correo.msj);
|
||||
})
|
||||
.then((res) => ({
|
||||
message: '¡El ticket a sido validado de forma correcta!',
|
||||
}))
|
||||
.catch((err) => {
|
||||
throw new Error('¡ No fue posible validar la inscripción !. ');
|
||||
throw new Error('¡No fue posible validar la inscripción!');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user