/api/addPrinter added

This commit is contained in:
alfredojl
2020-09-16 19:57:44 -05:00
parent 4701ee1a88
commit a858262619
5 changed files with 72 additions and 7 deletions
@@ -0,0 +1,7 @@
const get = require('./get');
const post = require('./post');
module.exports = {
get,
post
};
+47
View File
@@ -0,0 +1,47 @@
const Tipo = require('../../models/tablas/Tipo');
const Marca = require('../../models/tablas/Marca');
const Ubicacion = require('../../models/tablas/Ubicacion');
const Uso = require('../../models/tablas/Uso');
const UResponsable = require('../../models/tablas/UResponsable');
const get = async(req, res) => {
const marcas = await Marca.findAll({
attributes: ['idMarca', 'marca'],
order: ['idMarca']
})
.catch((e) => { throw new Error(e) });
const unidades = await UResponsable.findAll({
attributes: ['idUnidadResponsable', 'uResponsable'],
order: ['idUnidadResponsable']
})
.catch((e) => { throw new Error(e) });
const ubicaciones = await Ubicacion.findAll({
attributes: ['idUbicacion', 'ubicacion'],
order: ['idUbicacion']
})
.catch((e) => { throw new Error(e) });
const usos = await Uso.findAll({
attributes: ['idUso', 'uso'],
order: ['idUso']
})
.catch((e) => { throw new Error(e) });
const tipos = await Tipo.findAll({
attributes: ['idTipo', 'tipo'],
order: ['idTipo']
})
.catch((e) => { throw new Error(e) });
return res.json({
unidades,
ubicaciones,
marcas,
usos,
tipos
});
};
module.exports = get;