arreglos a la validacion
This commit is contained in:
@@ -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 !',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user