/api/addPrinter added
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
const get = require('./get');
|
||||
const post = require('./post');
|
||||
|
||||
module.exports = {
|
||||
get,
|
||||
post
|
||||
};
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user