validacion y reporte

This commit is contained in:
Andres2908
2022-03-22 18:20:38 -06:00
parent e2a8dd5f98
commit 4cdadae9ba
2 changed files with 6 additions and 5 deletions
+4 -5
View File
@@ -3,16 +3,15 @@ const dbPath = '../../db/tablas';
const Inscripcion = require(`${dbPath}/Inscripcion`);
const validarTicket = async (body) => {
const validacion = validarNumeroEntero(body.validacion, 'validacion', true);
const folio = validarNumeroEntero(body.folio, 'folio', true);
return Inscripcion.findOne({
where: { folio: body.folio },
where: { folio },
})
.then((res) => {
if (!res) throw new Error('Este folio no existe');
idUsuario = res.idUsuario;
if (validacion == 1) {
if (body.validacion == 1) {
return Inscripcion.findOne({
where: { folio, validacion: 1 },
});
@@ -22,7 +21,7 @@ const validarTicket = async (body) => {
if (res) throw new Error('Este folio ya fue validado');
return Inscripcion.update(
{
validacion,
validacion: body.validacion,
},
{
where: {
@@ -37,7 +36,7 @@ const validarTicket = async (body) => {
{ motivo: body.motivo },
{
where: {
folio: body.folio,
folio,
},
}
);