Files
pcpuma_acatlan_api/server/controller/Equipo/equipos.js
T

31 lines
913 B
JavaScript
Raw Normal View History

2021-05-03 23:38:03 -05:00
const dbPath = '../../db/tablas';
const Carrito = require(`${dbPath}/Carrito`);
const Equipo = require(`${dbPath}/Equipo`);
const Modulo = require(`${dbPath}/Modulo`);
const TipoCarrito = require(`${dbPath}/TipoCarrito`);
2021-04-29 19:43:33 -05:00
2021-05-04 00:32:04 -05:00
const equipos = async (body) => {
2021-09-02 09:53:11 -05:00
return Carrito.findAll({
include: [{ model: TipoCarrito }, { model: Modulo }],
}).then(async (res) => {
for (let i = 0; i < res.length; i++) {
res[i].dataValues.Equipos = await Equipo.findAll({
where: { idCarrito: res[i].idCarrito },
}).then((res) => {
for (let j = 0; j < res.length; j++) {
delete res[j].dataValues.idCarrito;
delete res[j].dataValues.idStatus;
delete res[j].dataValues.idPrograma;
}
return res;
});
2021-04-30 16:04:27 -05:00
2021-09-02 09:53:11 -05:00
delete res[i].dataValues.idTipoCarrito;
delete res[i].dataValues.idModulo;
2021-04-29 19:43:33 -05:00
}
2021-09-02 09:53:11 -05:00
return res;
2021-04-29 19:43:33 -05:00
});
};
2021-05-04 00:32:04 -05:00
module.exports = equipos;