/api/computers and /api/printers added

This commit is contained in:
alfredojl
2020-09-14 18:30:15 -05:00
parent f4f91d5c14
commit 22ac369b47
14 changed files with 116 additions and 106 deletions
+26
View File
@@ -0,0 +1,26 @@
const sequelize = require('../../config/sequelize.conf');
const { QueryTypes } = require('sequelize');
const printers = async(req, res) => {
await sequelize.query(`
SELECT I.noInventario, T.tipo, P.modelo, M.marca, P.noSerie, P. descripcion
FROM inventario I
INNER JOIN printers P ON P.noInventario = I.noInventario
INNER JOIN marca M ON M.idMarca = P.idMarca
INNER JOIN tipo T ON T.idTipo = P.idTipo
ORDER BY T.tipo
`, { type: QueryTypes.SELECT })
.then(printers => {
return res.json({
printers
});
})
.catch(error => res.status(500).json({
error
}));
}
module.exports = printers;