Files
inscripciones_api/server/controller/Admin/todasInscripciones.js
T

22 lines
670 B
JavaScript
Raw Normal View History

2022-02-10 00:44:23 -06:00
const { Op } = require('sequelize');
2022-02-02 19:31:16 -06:00
const dbPath = '../../db/tablas';
const Usuario = require(`${dbPath}/Usuario`);
const Inscripcion = require(`${dbPath}/Inscripcion`);
2022-03-21 23:29:29 -06:00
const { validarNumeroEntero } = require('../../helper/validar');
2022-02-02 19:31:16 -06:00
const todasInscripciones = async (body) => {
2022-03-21 14:03:30 -06:00
const validacion = validarNumeroEntero(body.validacion, 'validacion', true);
2022-02-02 19:31:16 -06:00
return Inscripcion.findAll({
2022-03-21 14:03:30 -06:00
where: { validacion, cancelacion: 0 },
2022-02-02 19:31:16 -06:00
include: [
{
model: Usuario,
2022-02-16 00:11:35 -06:00
where: { numeroCuenta: { [Op.like]: `%${body.numeroCuenta}%` } },
2022-02-03 23:09:40 -06:00
attributes: ['idUsuario', 'numeroCuenta'],
2022-02-02 19:31:16 -06:00
},
],
});
};
module.exports = todasInscripciones;