2022-03-06 18:41:23 -06:00
|
|
|
const dbPath = '../../db/tablas';
|
|
|
|
|
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
2022-03-21 23:29:29 -06:00
|
|
|
const { validarNumeroEntero } = require('../../helper/validar');
|
2022-03-06 18:41:23 -06:00
|
|
|
|
|
|
|
|
const validarSinTicket = async (body) => {
|
2022-03-21 14:03:30 -06:00
|
|
|
const idUsuario = validarNumeroEntero(body.idUsuario, 'usuario', true);
|
2022-03-17 00:46:01 -06:00
|
|
|
return Inscripcion.update(
|
|
|
|
|
{
|
|
|
|
|
validacion: 1,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
where: {
|
2022-03-21 14:03:30 -06:00
|
|
|
idUsuario,
|
2022-03-17 00:46:01 -06:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
)
|
2022-03-06 20:02:42 -06:00
|
|
|
.then((res) => ({
|
2022-03-17 00:46:01 -06:00
|
|
|
message: '¡El ticket a sido validado de forma correcta!',
|
2022-03-06 20:02:42 -06:00
|
|
|
}))
|
2022-03-06 18:41:23 -06:00
|
|
|
.catch((err) => {
|
|
|
|
|
throw new Error('¡ No fue posible validar la inscripción !. ');
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = validarSinTicket;
|