const dbPath = '../../db/tablas'; const Inscripcion = require(`${dbPath}/Inscripcion`); const ticket = async (body) => { return Inscripcion.findOne({ where: { folio: body.folio }, attributes: ['rutaTicket', 'extension', 'motivo'], }) .then((res) => { if (!res) throw new Error('No pudimos encontrar este ticket.'); return { rutaTicket: res.rutaTicket, extension: res.extension, motivo: res.motivo, }; }) .catch((err) => { throw new Error('No fue posible validar el ticket. ' + err); }); }; module.exports = ticket;