arreglos a la validacion

This commit is contained in:
Andres2908
2022-03-06 20:02:42 -06:00
parent 4eb67e7f3f
commit 80852bb2c9
5 changed files with 27 additions and 11 deletions
+7 -2
View File
@@ -10,6 +10,12 @@ const validarTicket = async (body) => {
.then((res) => {
if (!res) throw new Error('Este folio no existe');
idUsuario = res.idUsuario;
return Inscripcion.findOne({
where: { folio: body.folio, validacion: 1 },
});
})
.then((res) => {
if (res) throw new Error('Este folio ya fue validado');
return Inscripcion.update(
{
validacion: body.validacion,
@@ -23,7 +29,6 @@ const validarTicket = async (body) => {
);
})
.then((res) => {
if (!res) throw new Error('Este ticket ya fue validado');
if (body.validacion === 0)
throw new Error(
'El administrador a declinado el ticket, ya que los datos no coinciden.'
@@ -34,7 +39,7 @@ const validarTicket = async (body) => {
where: { idUsuario },
attributes: ['numeroCuenta'],
}).then((res) => {
return usuarioInscrito(res.numeroCuenta).then(async (res) => {
return usuarioInscrito(res.numeroCuenta, 1).then(async (res) => {
return {
message: '¡ El ticket a sido validado de forma correcta !',
};