motivo de declinacion

This commit is contained in:
Andres2908
2022-03-18 01:29:10 -06:00
parent a9d148e714
commit 47f48a4464
4 changed files with 39 additions and 4 deletions
+21
View File
@@ -0,0 +1,21 @@
const dbPath = '../../db/tablas';
const Inscripcion = require(`${dbPath}/Inscripcion`);
const { validarNumeroEntero } = require('../../helper/validar');
const motivo = async (body) => {
return Inscripcion.findOne({
where: { folio: body.folio },
})
.then((res) => {
if (!res) throw new Error('No pudimos encontrar este ticket.');
return Inscripcion.findOne({
where: { folio: body.folio },
attributes: ['motivo'],
});
})
.catch((err) => {
throw new Error('No fue posible encontrar el ticket. ' + err);
});
};
module.exports = motivo;
+6 -3
View File
@@ -1,15 +1,18 @@
const dbPath = '../../db/tablas';
const Usuario = require(`${dbPath}/Usuario`);
const Inscripcion = require(`${dbPath}/Inscripcion`);
const ticket = async (body) => {
return Inscripcion.findOne({
where: { folio: body.folio },
attributes: ['rutaTicket', 'extension'],
attributes: ['rutaTicket', 'extension', 'motivo'],
})
.then((res) => {
if (!res) throw new Error('No pudimos encontrar este ticket.');
return { rutaTicket: res.rutaTicket, extension: res.extension };
return {
rutaTicket: res.rutaTicket,
extension: res.extension,
motivo: res.motivo,
};
})
.catch((err) => {
throw new Error('No fue posible validar el ticket. ' + err);