22 lines
670 B
JavaScript
22 lines
670 B
JavaScript
const { Op } = require('sequelize');
|
|
const dbPath = '../../db/tablas';
|
|
const Usuario = require(`${dbPath}/Usuario`);
|
|
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
|
const { validarNumeroEntero } = require('../../helper/validar');
|
|
|
|
const todasInscripciones = async (body) => {
|
|
const validacion = validarNumeroEntero(body.validacion, 'validacion', true);
|
|
return Inscripcion.findAll({
|
|
where: { validacion, cancelacion: 0 },
|
|
include: [
|
|
{
|
|
model: Usuario,
|
|
where: { numeroCuenta: { [Op.like]: `%${body.numeroCuenta}%` } },
|
|
attributes: ['idUsuario', 'numeroCuenta'],
|
|
},
|
|
],
|
|
});
|
|
};
|
|
|
|
module.exports = todasInscripciones;
|