47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
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; |