26 lines
811 B
JavaScript
26 lines
811 B
JavaScript
|
|
const sequelize = require('../../config/sequelize.conf');
|
||
|
|
|
||
|
|
const { QueryTypes } = require('sequelize');
|
||
|
|
|
||
|
|
const get = async(req, res) => {
|
||
|
|
const noInventario = req.query.noInventario;
|
||
|
|
|
||
|
|
await sequelize.query(`
|
||
|
|
SELECT I.noInventario, I.noResguardo, I.idUnidadResponsable, I.idUbicacion, I.idUso, P.idTipo, P.modelo, P.idMarca, P.noSerie, P.descripcion
|
||
|
|
FROM inventario I, printers P
|
||
|
|
WHERE I.noInventario = P.noInventario
|
||
|
|
AND I.noInventario = :noInventario`, {
|
||
|
|
replacements: { noInventario },
|
||
|
|
type: QueryTypes.SELECT
|
||
|
|
})
|
||
|
|
.then((printer) => {
|
||
|
|
return res.json({
|
||
|
|
printer
|
||
|
|
})
|
||
|
|
}).catch((err) => res.status(500).json({
|
||
|
|
ok: false,
|
||
|
|
err
|
||
|
|
}));
|
||
|
|
};
|
||
|
|
|
||
|
|
module.exports = get;
|