Insertamos datos a la tabla del SAT

This commit is contained in:
Andres2908
2022-03-04 01:05:26 -06:00
parent 1fe9d21329
commit 2d7cf996d2
3 changed files with 12 additions and 14 deletions
+12 -5
View File
@@ -1,13 +1,15 @@
const dbPath = '../../db/tablas';
const Inscripcion = require(`${dbPath}/Inscripcion`);
const Usuario = require(`${dbPath}/Usuario`);
const { usuarioInscrito } = require('../../config/mariadb.conf');
const validarTicket = async (body) => {
console.log(body);
return Inscripcion.findOne({
where: { folio: body.folio },
})
.then((res) => {
if (!res) throw new Error('Este folio no existe');
idUsuario = res.idUsuario;
return Inscripcion.update(
{
validacion: body.validacion,
@@ -26,10 +28,15 @@ const validarTicket = async (body) => {
);
})
.then((res) => {
return usuarioInscrito(body.numeroCuenta).then(async (res) => {
return {
message: '¡ El ticket a sido validado de forma correcta !',
};
return Usuario.findOne({
where: { idUsuario },
attributes: ['numeroCuenta'],
}).then((res) => {
return usuarioInscrito(res.numeroCuenta).then(async (res) => {
return {
message: '¡ El ticket a sido validado de forma correcta !',
};
});
});
})
.catch((err) => {