tabla motivo

This commit is contained in:
2022-03-21 20:48:29 -06:00
parent b33deda664
commit c04ca252df
6 changed files with 99 additions and 7 deletions
@@ -0,0 +1,27 @@
const { validarNumeroEntero } = require('../../helper/validar');
const dbPath = '../../db/tablas';
const Motivo = require(`${dbPath}/Motivo`);
const Equipo = require(`${dbPath}/Equipo`);
const Status = require(`${dbPath}/Status`);
const historialMotivosEquipo = async (body) => {
const pagina = validarNumeroEntero(body.pagina, 'página', false);
const idEquipo = validarNumeroEntero(body.idEquipo, 'id equipo', true);
return Motivo.findAndCountAll({
include: [
{
model: Equipo,
where: { idEquipo },
// attributes: [],
},
{ model: Status },
],
attributes: ['idMotivo', 'motivo'],
limit: 25,
offset: 25 * (pagina - 1),
order: [['idMotivo', 'DESC']],
});
};
module.exports = historialMotivosEquipo;