validacion folio

This commit is contained in:
Andres2908
2022-03-21 15:17:20 -06:00
parent 2cd8c0810c
commit 3f1099b29b
6 changed files with 20 additions and 14 deletions
+4 -4
View File
@@ -9,8 +9,8 @@ const actualizarTicket = async (body) => {
'id Inscripcion',
true
);
const monto = validarNumeroEntero(body.monto, 'monto', true);
const folio = validarNumeroEntero(body.folio, 'folio', true);
return Inscripcion.findOne({
where: {
@@ -21,9 +21,9 @@ const actualizarTicket = async (body) => {
if (!res) throw new Error('No pudimos encontrar este ticket.');
return Inscripcion.findOne({
where: {
folio: body.folio,
folio,
cancelacion: 0,
idInscripcion: {[Op.ne]: idInscripcion}
idInscripcion: { [Op.ne]: idInscripcion },
},
});
})
@@ -34,7 +34,7 @@ const actualizarTicket = async (body) => {
.then((res) => {
return Inscripcion.update(
{
folio: body.folio,
folio,
monto,
fechaTicket: body.fechaTicket,
},
+3 -1
View File
@@ -1,8 +1,10 @@
const { validarNumeroEntero } = require('../../helper/validar');
const dbPath = '../../db/tablas';
const Inscripcion = require(`${dbPath}/Inscripcion`);
const motivo = async (body) => {
const folio = body.folio;
const folio = validarNumeroEntero(body.folio, 'folio', true);
return Inscripcion.findOne({
where: { folio },
})
+1 -1
View File
@@ -38,7 +38,7 @@ const reporte = async (body) => {
hizoPago: res[i].hizoPago,
fechaInscripcion: moment(res[i].fechaInscripcion).format('L'),
validacion: res[i].validacion,
motivoCancelacion: res[i].motivo,
motivoDeclinacion: res[i].motivo,
});
}
await helper.eliminarArchivo(path).catch((err) => {});
+3
View File
@@ -1,7 +1,10 @@
const { validarNumeroEntero } = require('../../helper/validar');
const dbPath = '../../db/tablas';
const Inscripcion = require(`${dbPath}/Inscripcion`);
const ticket = async (body) => {
const folio = validarNumeroEntero(body.folio, 'folio', true);
return Inscripcion.findOne({
where: { folio: body.folio },
attributes: ['rutaTicket', 'extension', 'motivo'],
@@ -1,7 +1,4 @@
const {
validarNumeroCuenta,
validarNumeroEntero,
} = require('../../helper/validar');
const { validarNumeroEntero } = require('../../helper/validar');
const { Op } = require('sequelize');
const dbPath = '../../db/tablas';
const Usuario = require(`${dbPath}/Usuario`);
+8 -4
View File
@@ -1,16 +1,20 @@
const { validarNumeroEntero } = require('../../helper/validar');
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 },
})
.then((res) => {
if (!res) throw new Error('Este folio no existe');
idUsuario = res.idUsuario;
if (body.validacion == 1) {
if (validacion == 1) {
return Inscripcion.findOne({
where: { folio: body.folio, validacion: 1 },
where: { folio, validacion: 1 },
});
}
})
@@ -18,11 +22,11 @@ const validarTicket = async (body) => {
if (res) throw new Error('Este folio ya fue validado');
return Inscripcion.update(
{
validacion: body.validacion,
validacion,
},
{
where: {
folio: body.folio,
folio,
},
}
);