Varios archivos de backend agregados.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
"CENTRO DE EDUCACIÓN CONTINUA",
|
||||
"CENTRO DE ENSEÑANZA DE IDIOMAS",
|
||||
"CENTRO DE ESTUDIOS MUNICIPALES Y METROPOLITANOS",
|
||||
"CENTRO TECNOLÓGICO PARA LA EDUCACIÓN A DISTANCIA, CETED",
|
||||
"CENTRO TECNOLÓGICO PARA LA EDUCACIÓN A DISTANCIA",
|
||||
"COORDINACIÓN DE ACTIVIDADES DEPORTIVAS Y RECREATIVAS",
|
||||
"COORDINACIÓN DE COMUNICACIÓN SOCIAL",
|
||||
"COORDINACIÓN DE GESTIÓN DE LA DIRECCIÓN",
|
||||
@@ -21,7 +21,7 @@
|
||||
"DEPARTAMENTO DE ADQUISICIONES BIBLIOGRÁFICAS Y PROCESOS TÉCNICOS",
|
||||
"DEPARTAMENTO DE ALEMÁN, GRIEGO Y RUSO",
|
||||
"DEPARTAMENTO DE ALMACENES E INVENTARIOS",
|
||||
"DEPARTAMENTO DE ANÁLISIS DE RIESGOS NATURALES Y ANTROPOÉNICOS (UIM",
|
||||
"DEPARTAMENTO DE ANÁLISIS DE RIESGOS NATURALES Y ANTROPOÉNICOS",
|
||||
"DEPARTAMENTO DE APOYO TÉCNICO AL CENTRO CULTURAL",
|
||||
"DEPARTAMENTO DE CONSULTA",
|
||||
"DEPARTAMENTO DE ESPAÑOL PARA EXT. Y LENGUAS NO INDOEUROPEAS",
|
||||
@@ -44,25 +44,24 @@
|
||||
"DEPARTAMENTO DE PROMOCIÓN Y ORGANIZACIÓN DEPORTIVA",
|
||||
"DEPARTAMENTO DE PROYECCIÓN EMPRESARIAL E INTERCAMBIO Y COLABORACIÓN INSTITUCIONAL",
|
||||
"DEPARTAMENTO DE PROYECTOS ADMINISTRATIVOS",
|
||||
"DEPARTAMENTO DE REDES Y SOPORTE TÉCNICO (CEDETEC",
|
||||
"DEPARTAMENTO DE REDES Y SOPORTE TÉCNICO",
|
||||
"DEPARTAMENTO DE REGISTRO Y CERTIFICACIÓN DE LA DIVISIÓN S.U.A",
|
||||
"DEPARTAMENTO DE REGISTRO Y CERTIFICACIÓN DE POSGRADO",
|
||||
"DEPARTAMENTO DE REGISTRO Y CERTIFICACION DEL C.E.I",
|
||||
"DEPARTAMENTO DE REPRODUCCIONES GRÁFICAS",
|
||||
"DEPARTAMENTO DE SERVICIO SOCIAL Y BOLSA DE TRABAJO",
|
||||
"DEPARTAMENTO DE SERVICIOS AL PÚBLICO (CID",
|
||||
"DEPARTAMENTO DE SERVICIOS AL PÚBLICO",
|
||||
"DEPARTAMENTO DE SERVICIOS AUDIOVISUALES",
|
||||
"DEPARTAMENTO DE SERVICIOS DE CÓMPUTO",
|
||||
"DEPARTAMENTO DE SERVICIOS GENERALES DE MANTENIMIENTO",
|
||||
"DEPARTAMENTO DE SISTEMAS DE INFORMACIÓN",
|
||||
"DEPARTAMENTO DE SUPERVISIÓN TÉCNICA Y SEGUIMIENTO",
|
||||
"DEPARTAMENTO DE TALLERES Y LABORATORIOS",
|
||||
"DEPARTAMENTO DE TECNOLOGÍA AMBIENTAL (UIM",
|
||||
"DEPARTAMENTO DE TECNOLOGÍA AMBIENTAL",
|
||||
"DEPARTAMENTO DE TIPOGRAFÍA Y DISEÑO",
|
||||
"DEPARTAMENTO DE TÍTULOS PROFESIONALES Y CERTIFICACIÓN",
|
||||
"DEPARTAMENTO DE TRANSPORTES Y SERVICIOS DE APOYO",
|
||||
"DEPARTAMENTO DE VIGILANCIA",
|
||||
"DEVOLUCIÓN DE ACTIVO FIJO AL ALMACÉN POR OBSOLESCENCIA, DESUSO O DESTRUCCIÓN",
|
||||
"DIVISIÓN DE CIENCIAS JURÍDICAS",
|
||||
"DIVISIÓN DE CIENCIAS SOCIOECONÓMICAS",
|
||||
"DIVISIÓN DE DISEÑO Y EDIFICACIÓN",
|
||||
@@ -95,7 +94,7 @@
|
||||
"UNIDAD DE ADMINISTRACIÓN Y RECURSOS",
|
||||
"UNIDAD DE LA OFICINA JURÍDICA",
|
||||
"UNIDAD DE PLANEACIÓN",
|
||||
"UNIDAD DE PROCESO (U.P.A",
|
||||
"UNIDAD DE PROCESO",
|
||||
"UNIDAD DE SERVICIOS A LA COMUNIDAD",
|
||||
"UNIDAD DE SERVICIOS EDITORIALES",
|
||||
"UNIDAD DE TALLERES, LABORATORIOS Y AUDIOVISUALES",
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
const get = require('./get');
|
||||
const post = require('./post');
|
||||
const put = require('./put');
|
||||
const delet = require('./delete');
|
||||
|
||||
module.exports = {
|
||||
get,
|
||||
post,
|
||||
put,
|
||||
delete: delet
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
const ActivoFijo = require('../../models/tablas/ActivoFijo');
|
||||
const Marca = require('../../models/tablas/Marca');
|
||||
const OS = require('../../models/tablas/OS');
|
||||
const Tipo = require('../../models/tablas/Tipo');
|
||||
const Ubicacion = require('../../models/tablas/Ubicacion')
|
||||
const UResponsable = require('../../models/tablas/UResponsable');
|
||||
const Uso = require('../../models/tablas/Uso');
|
||||
|
||||
const get = async(req, res) => {
|
||||
let activosFijos = await ActivoFijo.findAll({
|
||||
attributes: ['idActivoFijo', 'activoFijo'],
|
||||
order: ['idActivoFijo']
|
||||
})
|
||||
.catch((e) => { throw new Error(e) });
|
||||
|
||||
let marcas = await Marca.findAll({
|
||||
attributes: ['idMarca', 'marca'],
|
||||
order: ['idMarca']
|
||||
})
|
||||
.catch((e) => { throw new Error(e) });
|
||||
|
||||
let distros = await OS.findAll({
|
||||
attributes: ['idOS', 'osname'],
|
||||
order: ['idOS']
|
||||
})
|
||||
.catch((e) => { throw new Error(e) });
|
||||
|
||||
let tipos = await Tipo.findAll({
|
||||
attributes: ['idTipo', 'tipo'],
|
||||
order: ['idTipo']
|
||||
})
|
||||
.catch((e) => { throw new Error(e) });
|
||||
|
||||
let ubicaciones = await Ubicacion.findAll({
|
||||
attributes: ['idUbicacion', 'ubicacion'],
|
||||
order: ['idUbicacion']
|
||||
})
|
||||
.catch((e) => { throw new Error(e) });
|
||||
|
||||
let unidades = await UResponsable.findAll({
|
||||
attributes: ['idUnidadResponsable', 'uResponsable'],
|
||||
order: ['idUnidadResponsable']
|
||||
})
|
||||
.catch((e) => { throw new Error(e) });
|
||||
|
||||
let usos = await Uso.findAll({
|
||||
attributes: ['idUso', 'uso'],
|
||||
order: ['idUso']
|
||||
})
|
||||
.catch((e) => { throw new Error(e) });
|
||||
|
||||
return res.json({
|
||||
activosFijos,
|
||||
marcas,
|
||||
distros,
|
||||
ubicaciones,
|
||||
unidades,
|
||||
usos
|
||||
})
|
||||
};
|
||||
|
||||
module.exports = get;
|
||||
@@ -0,0 +1,61 @@
|
||||
const Equipo = require('../../models/tablas/Equipo');
|
||||
const Inventario = require('../../models/tablas/Inventario');
|
||||
|
||||
const put = async(req, res) => {
|
||||
const modelo = req.body.modelo;
|
||||
const idMarca = req.body.idMarca;
|
||||
const noSerie = req.body.noSerie;
|
||||
const idOS = req.body.idOS;
|
||||
const procesador = req.body.procesador;
|
||||
const vProcesador = req.body.vProcesador;
|
||||
const memoria = req.body.memoria;
|
||||
const memoriasz = req.body.memoriasz;
|
||||
const vMemoria = req.body.vMemoria;
|
||||
const graficos = req.body.graficos;
|
||||
const hdd = req.body.hdd;
|
||||
const noInventario = req.body.noInventario;
|
||||
const idActivoFijo = req.body.idActivoFijo;
|
||||
const noResguardo = req.body.noResguardo;
|
||||
const idUnidadResponsable = req.body.idUnidadResponsable;
|
||||
const idUbicacion = req.body.idUbicacion;
|
||||
const idUso = req.body.idUso;
|
||||
|
||||
await Inventario.create({
|
||||
noInventario,
|
||||
idActivoFijo,
|
||||
noResguardo,
|
||||
idUnidadResponsable,
|
||||
idUbicacion,
|
||||
idUso
|
||||
})
|
||||
.catch((e) => res.json({
|
||||
ok: false,
|
||||
error: e
|
||||
}));
|
||||
|
||||
await Equipo.create({
|
||||
modelo,
|
||||
noSerie,
|
||||
procesador,
|
||||
vProcesador,
|
||||
memoria,
|
||||
memoriasz,
|
||||
vMemoria,
|
||||
graficos,
|
||||
hdd,
|
||||
noInventario,
|
||||
idMarca,
|
||||
idOS,
|
||||
idActivoFijo
|
||||
})
|
||||
.then(() => res.json({
|
||||
ok: true,
|
||||
message: 'Equipo agregado en inventario con éxito.'
|
||||
}))
|
||||
.catch((e) => res.json({
|
||||
ok: false,
|
||||
error: e
|
||||
}));
|
||||
};
|
||||
|
||||
module.exports = put;
|
||||
@@ -0,0 +1,49 @@
|
||||
const Printers = require('../../models/tablas/Printers');
|
||||
const Inventario = require('../../models/tablas/Inventario');
|
||||
|
||||
const post = async(req, res) => {
|
||||
const noSerie = req.body.noSerie;
|
||||
const noInventario = req.body.noInventario;
|
||||
const modelo = req.body.modelo;
|
||||
const idActivoFijo = req.body.idActivoFijo;
|
||||
const idMarca = req.body.idMarca;
|
||||
const idTipo = req.body.idTipo;
|
||||
const descripcion = req.body.descripcion;
|
||||
const noResguardo = req.body.noResguardo;
|
||||
const idUnidadResponsable = req.body.idUnidadResponsable;
|
||||
const idUbicacion = req.body.idUbicacion;
|
||||
const idUso = req.body.idUso;
|
||||
|
||||
await Inventario.create({
|
||||
noInventario,
|
||||
noResguardo,
|
||||
idActivoFijo,
|
||||
idUnidadResponsable,
|
||||
idUbicacion,
|
||||
idUso
|
||||
})
|
||||
.catch((e) => res.json({
|
||||
ok: false,
|
||||
error: e
|
||||
}));
|
||||
|
||||
await Printers.create({
|
||||
noSerie,
|
||||
noInventario,
|
||||
modelo,
|
||||
idActivoFijo,
|
||||
idMarca,
|
||||
idTipo,
|
||||
descripcion
|
||||
})
|
||||
.then(() => res.json({
|
||||
ok: true,
|
||||
message: 'Impresora agregada en inventario con éxito.'
|
||||
}))
|
||||
.catch((e) => res.json({
|
||||
ok: false,
|
||||
error: e
|
||||
}));
|
||||
};
|
||||
|
||||
module.exports = post;
|
||||
@@ -15,8 +15,7 @@ const post = async(req, res) => {
|
||||
})
|
||||
.then((user) => {
|
||||
if (!bcrypt.compareSync(body.password, user.password)) {
|
||||
console.log('Invalid user or password');
|
||||
return res.json({
|
||||
return res.status(500).json({
|
||||
err: {
|
||||
message: 'Invalid user or password'
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
const get = require('./get');
|
||||
|
||||
const post = require('./post');
|
||||
|
||||
const put = require('./put');
|
||||
|
||||
module.exports = {
|
||||
get,
|
||||
post,
|
||||
put
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
const sequelize = require('../../../config/sequelize.conf');
|
||||
|
||||
const { QueryTypes } = require('sequelize');
|
||||
|
||||
|
||||
const computers = async(req, res) => {
|
||||
const get = async(req, res) => {
|
||||
// res.json({
|
||||
// message: "Listo"
|
||||
// });
|
||||
@@ -27,7 +27,6 @@ const computers = async(req, res) => {
|
||||
.catch(error => res.status(500).json({
|
||||
error
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
module.exports = computers;
|
||||
module.exports = get;
|
||||
@@ -0,0 +1,25 @@
|
||||
const sequelize = require('../../../config/sequelize.conf');
|
||||
|
||||
const { QueryTypes } = require('sequelize')
|
||||
|
||||
const post = async(req, res) => {
|
||||
let body = req.body;
|
||||
|
||||
await sequelize.query(`
|
||||
INSERT INTO equipo(modelo, noSerie, procesador, vProcesador, memoria, memoriasz, vMemoria, graficos, hdd, idActivoFIjo, noInventario, idMarca, idOS)
|
||||
VALUES (${body.modelo}, ${body.noSerie}, ${body.procesador}, ${body.vProcesador}, ${body.memoria}, ${body.memoriasz}, ${body.vMemoria}, ${body.graficos}, ${body.hdd}, ${body.idActivoFijo}, ${body.noInventario}, ${body.idMarca}, ${body.idOS})
|
||||
`)
|
||||
.catch(() => { throw new Error('Equipo error.') });
|
||||
|
||||
await sequelize.query(`
|
||||
INSERT INTO printers (noInventario, noSerie, modelo, descripcion, idMarca, idTipo, idActivoFijo)
|
||||
VALUES (${body.noInventario}, ${body.noSerie}, ${body.modelo}, ${body.descripcion}, ${body.idMarca}, ${body.idTipo}, ${body.idActivoFijo})
|
||||
`)
|
||||
.catch(() => { throw new Error('Printers error.') });
|
||||
|
||||
await sequelize.query(`
|
||||
INSERT INTO inventario (noResguardo, idActivoFijo, noInventario, idUnidadResponsable, idUbicacion, idUso)
|
||||
VALUES (${body.noResguardo}, ${body.idActivoFijo}, ${body.noInventario}, ${body.idUnidadResponsable}, ${body.idUbicacion}, ${body.idUso})
|
||||
`)
|
||||
.catch(() => { throw new Error('Inventario error') });
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
const sequelize = require('../../../config/sequelize.conf');
|
||||
|
||||
const { QueryTypes } = require('sequelize');
|
||||
|
||||
const put = async(req, res) => {
|
||||
let body = req.body;
|
||||
|
||||
|
||||
};
|
||||
|
||||
module.exports = put;
|
||||
@@ -1,8 +1,8 @@
|
||||
const sequelize = require('../../config/sequelize.conf');
|
||||
const sequelize = require('../../../config/sequelize.conf');
|
||||
|
||||
const { QueryTypes } = require('sequelize');
|
||||
|
||||
const printers = async(req, res) => {
|
||||
const get = async(req, res) => {
|
||||
|
||||
await sequelize.query(`
|
||||
SELECT I.noInventario, T.tipo, P.modelo, M.marca, P.noSerie, P. descripcion
|
||||
@@ -23,4 +23,4 @@ const printers = async(req, res) => {
|
||||
|
||||
}
|
||||
|
||||
module.exports = printers;
|
||||
module.exports = get;
|
||||
@@ -0,0 +1,5 @@
|
||||
const get = require('./get');
|
||||
|
||||
module.exports = {
|
||||
get
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
let express = require('express');
|
||||
let app = express();
|
||||
|
||||
const addEquip = require('../controller/addEquip/addEquip');
|
||||
const { verifyToken, verifyAdmin } = require('../middlewares/authentication');
|
||||
|
||||
const route = '/api/addEquip';
|
||||
|
||||
app.get(route, [verifyToken, verifyAdmin], (req, res) => {
|
||||
return addEquip.get(req, res);
|
||||
});
|
||||
|
||||
app.post(route, [verifyToken, verifyAdmin], (req, res) => {
|
||||
return addEquip.post(req, res);
|
||||
});
|
||||
|
||||
app.put(route, [verifyToken, verifyAdmin], (req, res) => {
|
||||
return addEquip.put(req, res);
|
||||
});
|
||||
|
||||
app.delete(route, [verifyToken, verifyAdmin], (req, res) => {
|
||||
return addEquip.delete(req, res);
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
@@ -3,5 +3,6 @@ let app = express();
|
||||
|
||||
app.use(require('./login'));
|
||||
app.use(require('./user'));
|
||||
app.use(require('./addEquip'));
|
||||
|
||||
module.exports = app;
|
||||
+27
-7
@@ -1,20 +1,40 @@
|
||||
let express = require('express');
|
||||
let app = express();
|
||||
|
||||
const computers = require('../controller/api/computers');
|
||||
const printers = require('../controller/api/printers');
|
||||
// const computers_get = require('../controller/user/computers/get');
|
||||
// const printers = require('../controller/user/printers/get');
|
||||
const computers = require('../controller/user/computers/computers');
|
||||
const printers = require('../controller/user/printers/printers');
|
||||
const { verifyToken, verifyAdmin } = require('../middlewares/authentication');
|
||||
|
||||
const computersRoute = '/api/computers';
|
||||
const printersRoute = '/api/printers';
|
||||
|
||||
/*=============================================
|
||||
computer
|
||||
=============================================*/
|
||||
app.get('/api/computers', verifyToken, (req, res) => {
|
||||
return computers.get(req, res);
|
||||
});
|
||||
|
||||
return computers(req, res);
|
||||
app.post(computersRoute, [verifyToken, verifyAdmin], (req, res) => {
|
||||
return computers.post(req, res);
|
||||
});
|
||||
|
||||
app.put(computersRoute, [verifyToken, verifyAdmin], (req, res) => {
|
||||
return computers.put(req, res);
|
||||
});
|
||||
|
||||
|
||||
/*=============================================
|
||||
printers
|
||||
=============================================*/
|
||||
app.get(printersRoute, verifyToken, (req, res) => {
|
||||
|
||||
return printers.get(req, res);
|
||||
|
||||
});
|
||||
|
||||
app.get('/api/printers', verifyToken, (req, res) => {
|
||||
|
||||
return printers(req, res);
|
||||
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
Reference in New Issue
Block a user