2020-09-16 18:03:09 -05:00
|
|
|
const sequelize = require('../../../config/sequelize.conf');
|
2020-09-10 03:06:23 -05:00
|
|
|
|
2020-09-14 18:30:15 -05:00
|
|
|
const { QueryTypes } = require('sequelize');
|
2020-09-10 03:06:23 -05:00
|
|
|
|
2020-09-14 18:30:15 -05:00
|
|
|
|
2020-09-16 18:03:09 -05:00
|
|
|
const get = async(req, res) => {
|
2020-09-10 03:06:23 -05:00
|
|
|
// res.json({
|
|
|
|
|
// message: "Listo"
|
|
|
|
|
// });
|
2020-09-22 00:56:48 -05:00
|
|
|
//console.log(req["tipo"].value);
|
2020-09-14 18:30:15 -05:00
|
|
|
await sequelize.query(`
|
2020-09-25 19:13:47 -05:00
|
|
|
SELECT I.noInventario, AF.activoFijo, E.modelo, M.marca, E.noSerie, E.procesador, E.vProcesador, E.hdd, E.memoriasz, E.memoria, E.vMemoria, E.graficos, OS.osname, I.noResguardo, UR.uResponsable, UR.nombreResponsable, Ub.ubicacion, U.uso
|
2020-09-14 18:30:15 -05:00
|
|
|
FROM inventario I
|
|
|
|
|
INNER JOIN activoFijo AF ON AF.idActivoFijo = I.idActivoFijo
|
|
|
|
|
INNER JOIN equipo E ON E.noInventario = I.noInventario
|
|
|
|
|
INNER JOIN marca M ON M.idMarca = E.idMarca
|
|
|
|
|
INNER JOIN OS ON OS.idOS = E.idOS
|
|
|
|
|
INNER JOIN uResponsable UR ON UR.idUnidadResponsable = I.idUnidadResponsable
|
|
|
|
|
INNER JOIN ubicacion Ub ON Ub.idUbicacion = I.idUbicacion
|
|
|
|
|
INNER JOIN uso U ON U.idUso = I.idUso
|
2020-09-17 21:24:57 -05:00
|
|
|
ORDER BY E.createdAt DESC`, { type: QueryTypes.SELECT })
|
2020-09-25 19:13:47 -05:00
|
|
|
.then(equipo => res.json({
|
|
|
|
|
equipo
|
|
|
|
|
}))
|
2020-09-14 18:30:15 -05:00
|
|
|
.catch(error => res.status(500).json({
|
|
|
|
|
error
|
|
|
|
|
}));
|
2020-09-10 03:06:23 -05:00
|
|
|
}
|
|
|
|
|
|
2020-09-16 18:03:09 -05:00
|
|
|
module.exports = get;
|