Filled out DB fixed.

This commit is contained in:
alfredojl
2020-09-10 03:06:23 -05:00
parent 57eb20271b
commit ef328ecf8a
34 changed files with 623 additions and 234 deletions
+1
View File
@@ -38,6 +38,7 @@ node_modules/
jspm_packages/
./.env
scratch/
./server/controller/api
# TypeScript v1 declaration files
typings/
+151 -213
View File
@@ -1,14 +1,14 @@
const activoFijo = require('../server/models/tablas/ActivoFijo');
const DescripcionAdicional = require('../server/models/tablas/DescripcionAdicional');
const Equipo = require('../server/models/tablas/Equipo');
const Inventario = require('../server/models/tablas/Inventario');
const Marca = require('../server/models/tablas/Marca');
const OS = require('../server/models/tablas/OS');
const Printers = require('../server/models/tablas/Printers');
const Tipo = require('../server/models/tablas/Tipo');
const Ubicacion = require('../server/models/tablas/Ubicacion');
const UResponsable = require('../server/models/tablas/UResponsable');
const Uso = require('../server/models/tablas/Uso');
const fillActivoFijo = require('./tables/ActivoFijo');
const fillDA = require('./tables/DescripcionAdicional');
const fillEquipo = require('./tables/Equipo');
const fillInventario = require('./tables/Inventario');
const fillMarca = require('./tables/Marca');
const fillOS = require('./tables/OS');
const fillPrinters = require('./tables/Printers');
const fillTipo = require('./tables/Tipo');
const fillUbicacion = require('./tables/Ubicacion');
const fillUResponsable = require('./tables/UResponsable');
const fillUso = require('./tables/Uso');
const faker = require('faker');
faker.locale = "es_MX";
@@ -16,217 +16,155 @@ faker.locale = "es_MX";
const colors = require('colors');
const symbols = require('log-symbols');
let rows = 5;
let rows = 10;
let faileds = 0;
let ok = 0;
let censo = 0;
async function fillingUp() {
await fillActivoFijo();
await fillDA();
await fillEquipo();
await fillInventario();
await fillMarca();
await fillOS();
await fillPrinters();
await fillTipo();
await fillUbicacion();
await fillUResponsable();
await fillUso();
async function fillingEquipo() {
for (let i = 0; i < rows; i++) {
let noInventario = faker.phone.phoneNumber("2######");
let idActivoFijo = idUso = faker.random.number({
min: 1,
max: 5
});
// await fillDA();
await fillInventario(noInventario, idActivoFijo)
.then(() => {
console.log(`${ i + 1 }/${ rows } records created on inventario-equipo`);
censo++;
})
.catch((e) => {
throw new Error(e);
});
await fillEquipo(noInventario, idActivoFijo)
.then(() => {
console.log(`${ i + 1 }/${ rows } records created on equipo`);
censo++;
})
.catch((e) => {
throw new Error(e);
});
}
return;
}
async function fillActivoFijo() {
let af = faker.random.arrayElement([
"PC",
"Laptop",
"Impresora",
"Servidor",
"Ipad",
"Chromebook"
]);
// console.log("Activo fijo: ", af);
await activoFijo.create({
activoFijo: af
});
async function fillingPrinters() {
for (let i = 0; i < rows; i++) {
let noInventario = faker.phone.phoneNumber("2######");
let idActivoFijo = 6;
await fillInventario(noInventario, idActivoFijo)
.then(() => console.log(`${ i + 1 }/${ rows } records created on inventario-printers`))
.catch((e) => {
console.log(symbols.warning, 'Error creating «inventario-printers»');
throw new Error(e);
});
await fillPrinters(noInventario)
.then(() => console.log(`${ i + 1 }/${ rows } records created on printers`))
.catch((e) => {
console.log(symbols.warning, 'Error creating «printers»');
throw new Error(e);
});
}
return;
}
async function fillDA() {
let da = faker.lorem.sentence();
// console.log("Descripción adicional: ", da);
await DescripcionAdicional.create({
descripcion: da
})
}
async function fillEquipo() {
let modelo = faker.vehicle.model();
let noSerie = faker.vehicle.vin();
let procesador = faker.random.arrayElement([
"Intel Core i3",
"Intel Core i5",
"Intel Core i7",
"Ryzen 3",
"Ryzen 5",
"Ryzen 7",
]);
let vProcesador = faker.random.number({ min: 2000, max: 4500 })
let memoria = faker.random.arrayElement([
"DDR2",
"DDR3",
"DDR4"
]);
let memoriasz = faker.random.arrayElement([
4096,
2048,
8192
]);
let vMemoria = faker.random.number({ min: 1400, max: 1800, precision: 4 });
let graficos = faker.random.arrayElement([
"Intel HD Graphics",
"Intel Iris",
"Intel Iris Plus",
"Radeon Vega 8",
"Radeon Vega 7",
"Radeon Vega Plus",
"Radeon Vega Graphics",
]);
let hdd = faker.random.number({
min: 80,
max: 990,
precision: 2
});
// console.log("Modelo: ", modelo, "\nNúmero de serie: ", noSerie, "\nProcesador: ", procesador, "\nVelocidad de procesador: ", vProcesador, "\nMemoria: ", memoria, "\nCantidad de memoria: ", memoriasz, "\nVelocidad de memoria: ", vMemoria, "\nGráficos: ", graficos, "\nTamaño de almacenamiento: ", hdd);
await Equipo.create({
modelo,
noSerie,
procesador,
vProcesador,
memoria,
memoriasz,
vMemoria,
graficos,
hdd
});
};
async function fillInventario() {
let noInventario = faker.phone.phoneNumber("2######")
let noResguardo = faker.phone.phoneNumber("#####")
// console.log("Inventario: ", noInventario, "\nResguardo: ", noResguardo);
await Inventario.create({
noInventario,
noResguardo
});
};
async function fillMarca() {
let marca = faker.random.arrayElement([
"HP",
"ECOIN",
"SONY",
"LENOVO",
"DELL",
"ACER",
"ASUS",
"APPLE",
"COMPAQ",
"GATEWAY",
"ECOIN",
"IBM"
]);
// console.log("Marca: ", marca);
await Marca.create({
marca
});
};
async function fillOS() {
let osname = faker.random.arrayElement([
"Windows 7",
"Windows 10",
"Debian",
"Fedora",
"CentOS",
"Ubuntu",
"MacOS"
]);
// console.log("Sistema operativo: ", osname);
await OS.create({
osname
});
};
async function fillPrinters() {
let noSerie = faker.vehicle.vin();
// console.log("Número de serie impresora: ", noSerie);
await Printers.create({
noSerie
});
};
async function fillTipo() {
let tipo = faker.random.arrayElement([
"Impresora",
"Multifuncional",
"Láser",
"Plotter"
]);
// console.log("Tipo de impresora: ", tipo);
await Tipo.create({
tipo
});
};
async function fillUbicacion() {
let ubicacion = faker.name.jobArea();
// console.log("Ubicación: ", ubicacion);
await Ubicacion.create({
ubicacion
});
};
async function fillUResponsable() {
let unidades = require('./unidades.json');
let uResponsable = faker.random.arrayElement(unidades);
let nombreResponsable = faker.name.findName();
// console.log("Unidad responsable: ", uResponsable, "\nNombre del responsable: ", nombreResponsable);
await UResponsable.create({
uResponsable,
nombreResponsable
});
};
async function fillUso() {
let uso = faker.name.jobType();
// console.log("Uso: ", uso);
await Uso.create({
uso
});
};
async function exec() {
await fillActivoFijo()
.then(() => {
console.log(symbols.success, '«activoFijo» filled out.'.green.bold)
ok++;
})
.catch(() => {
console.log(symbols.warning, 'Error creating «activoFijo».'.yellow.bold);
faileds++;
});
await fillMarca()
.then(() => {
console.log(symbols.success, '«marca» filled out.'.green.bold)
ok++;
})
.catch(() => {
console.log(symbols.warning, 'Error creating marca».'.yellow.bold);
faileds++;
});
await fillOS()
.then(() => {
console.log(symbols.success, '«OS» filled out.'.green.bold)
ok++;
})
.catch(() => {
console.log(symbols.warning, 'Error creating «OS».'.yellow.bold);
faileds++;
});
await fillTipo()
.then(() => {
console.log(symbols.success, '«tipo» filled out.'.green.bold)
ok++;
})
.catch(() => {
console.log(symbols.warning, 'Error creating «tipo».'.yellow.bold);
faileds++;
});
await fillUResponsable()
.then((records) => {
console.log(symbols.success, `${ records } records filled out.`.green.bold)
ok++;
})
.catch(() => {
console.log(symbols.warning, 'Error creating «uResponsable».'.yellow.bold);
faileds++;
});
await fillUbicacion()
.then(() => {
console.log(symbols.success, '«ubicacion» filled out.'.green.bold)
ok++;
})
.catch(() => {
console.log(symbols.warning, 'Error creating «ubicacion».'.yellow.bold);
faileds++;
});
await fillUso()
.then(() => {
console.log(symbols.success, '«uso» filled out.'.green.bold)
ok++;
})
.catch(() => {
console.log(symbols.warning, 'Error creating «uso».'.yellow.bold);
faileds++;
});
console.log(symbols.info, "Filling up database...".blue.bold);
console.log(`\nFilling out ${ rows } records on equipo, printers and inventario. Please wait...\n`.cyan.italic.bold);
for (let i = 0; i < rows; i++) {
console.log(`Creating record ${i + 1}/${rows}.`.yellow);
await fillingUp();
}
console.log(symbols.success, `${ rows } records created succesfully.`.green.bold);
await fillingEquipo()
.then(() => {
console.log(symbols.success, `${ rows } records created on equipo.\n`.green.bold);
ok++;
})
.catch((e) => {
console.log(symbols.warning, 'Error creating «equipo».\n', e);
faileds++;
});
await fillingPrinters()
.then(() => {
console.log(symbols.success, `${ rows } records created on printers.\n`.green.bold);
ok++;
})
.catch((e) => {
console.log(symbols.warning, 'Error creating «printers».\n', e);
faileds++;
});
if (censo / 2 === rows) ok++;
else faileds++;
console.log(symbols.success, `${ censo } records added on inventario`.green.bold);
console.log(`\n${ symbols.success }`, ` ${ ok } tables filled out succesfully.`.green.bold);
console.log(symbols.error, ` ${ faileds } tables wasn't filled out successfully.`.red.bold);
process.exit();
}
exec();
+31
View File
@@ -0,0 +1,31 @@
const ActivoFijo = require('../../server/models/tablas/ActivoFijo');
async function fillActivoFijo() {
console.log('\n\tFilling out «activoFijo».'.cyan.italic.bold);
let af = [
"PC",
"Laptop",
"Servidor",
"Ipad",
"Chromebook",
"Impresora"
];
let count = 1;
let limit = 6;
for (activoFijo of af) {
await ActivoFijo.create({
activoFijo
})
.then(() => {
console.log(`${ count }/${ limit }\trecords created.`);
count++;
})
.catch(() => {
throw new Error()
});
};
};
module.exports = fillActivoFijo;
+16
View File
@@ -0,0 +1,16 @@
const DescripcionAdicional = require('../../server/models/tablas/DescripcionAdicional');
const faker = require('faker');
faker.locale = "es_MX";
async function fillDA() {
let da = faker.lorem.sentence();
// console.log("Descripción adicional: ", da);
await DescripcionAdicional.create({
descripcion: da
});
};
module.exports = fillDA;
+79
View File
@@ -0,0 +1,79 @@
const Equipo = require('../../server/models/tablas/Equipo');
const faker = require('faker');
faker.locale = "es_MX";
async function fillEquipo(noInventario, idActivoFijo) {
let modelo = faker.vehicle.model();
let noSerie = faker.vehicle.vin();
let idMarca = faker.random.number({
min: 1,
max: 11
});
let idOS = faker.random.number({
min: 1,
max: 7
});
let procesador = faker.random.arrayElement([
"Intel Core i3",
"Intel Core i5",
"Intel Core i7",
"Ryzen 3",
"Ryzen 5",
"Ryzen 7",
]);
let vProcesador = faker.random.number({ min: 2000, max: 4500 })
let memoria = faker.random.arrayElement([
"DDR2",
"DDR3",
"DDR4"
]);
let memoriasz = faker.random.arrayElement([
4096,
2048,
8192
]);
let vMemoria = faker.random.number({ min: 1400, max: 1800, precision: 4 });
let graficos = faker.random.arrayElement([
"Intel HD Graphics",
"Intel Iris",
"Intel Iris Plus",
"Radeon Vega 8",
"Radeon Vega 7",
"Radeon Vega Plus",
"Radeon Vega Graphics",
]);
let hdd = faker.random.number({
min: 80,
max: 990,
precision: 2
});
// console.log("Modelo: ", modelo, "\nNúmero de serie: ", noSerie, "\nProcesador: ", procesador, "\nVelocidad de procesador: ", vProcesador, "\nMemoria: ", memoria, "\nCantidad de memoria: ", memoriasz, "\nVelocidad de memoria: ", vMemoria, "\nGráficos: ", graficos, "\nTamaño de almacenamiento: ", hdd);
await Equipo.create({
modelo,
noSerie,
procesador,
vProcesador,
memoria,
memoriasz,
vMemoria,
graficos,
hdd,
noInventario,
idMarca,
idOS
// idDescripcion
// idActivoFijo
})
.then(() => {
// console.log(`${ count }/${ limit }\trecords created.`);
// count++;
})
.catch(() => {
throw new Error();
});
};
module.exports = fillEquipo;
+39
View File
@@ -0,0 +1,39 @@
const Inventario = require('../../server/models/tablas/Inventario');
const faker = require('faker');
faker.locale = "es_MX";
async function fillInventario(noInventario, idActivoFijo) {
let idUbicacion = faker.random.number({
min: 1,
max: 15
});
let idUnidadResponsable = faker.random.number({
min: 1,
max: 101
});
let idUso = faker.random.number({
min: 1,
max: 6
});
let noResguardo = faker.phone.phoneNumber("#####")
// console.log("Inventario: ", noInventario, "\nResguardo: ", noResguardo);
await Inventario.create({
noResguardo,
idActivoFijo,
noInventario,
idUnidadResponsable,
idUbicacion,
idUso
})
.then(() => {
// console.log(`${ count }/${ limit }\trecords created.`);
// count++;
})
.catch(() => {
throw new Error();
});
};
module.exports = fillInventario;
+36
View File
@@ -0,0 +1,36 @@
const Marca = require('../../server/models/tablas/Marca');
async function fillMarca() {
let count = 1;
let limit = 11;
let marcas = [
"HP",
"ECOIN",
"SONY",
"LENOVO",
"DELL",
"ACER",
"ASUS",
"APPLE",
"COMPAQ",
"GATEWAY",
"IBM"
];
console.log('\n\tFilling out «marca».'.cyan.italic.bold);
for (marca of marcas) {
await Marca.create({
marca
})
.then(() => {
console.log(`${ count }/${ limit }\trecords created.`);
count++;
})
.catch(() => {
throw new Error();
});
};
};
module.exports = fillMarca;
+32
View File
@@ -0,0 +1,32 @@
const OS = require('../../server/models/tablas/OS');
async function fillOS() {
let count = 1;
let limit = 7;
let sistemas = [
"Windows 7",
"Windows 10",
"Debian",
"Fedora",
"CentOS",
"Ubuntu",
"MacOS"
];
console.log('\n\tFilling out «OS».'.cyan.italic.bold);
for (osname of sistemas) {
await OS.create({
osname
})
.then(() => {
console.log(`${ count }/${ limit }\trecords created.`);
count++;
})
.catch(() => {
throw new Error();
});
};
};
module.exports = fillOS;
+26
View File
@@ -0,0 +1,26 @@
const Printers = require('../../server/models/tablas/Printers');
const faker = require('faker');
faker.locale = "es_MX";
async function fillPrinters(noInventario) {
let noSerie = faker.vehicle.vin();
let idMarca = faker.random.number({
min: 1,
max: 11
});
let idTipo = faker.random.number({
min: 1,
max: 4
});
// console.log("Número de serie impresora: ", noSerie);
await Printers.create({
noInventario,
noSerie,
idMarca,
idTipo
});
};
module.exports = fillPrinters;
+29
View File
@@ -0,0 +1,29 @@
const Tipo = require('../../server/models/tablas/Tipo');
async function fillTipo() {
let count = 1;
let limit = 4;
let tipos = [
"Impresora",
"Multifuncional",
"Láser",
"Plotter"
];
console.log('\n\tFilling out «tipo».'.cyan.italic.bold);
for (tipo of tipos) {
await Tipo.create({
tipo
})
.then(() => {
console.log(`${ count }/${ limit }\trecords created.`);
count++;
})
.catch(() => {
throw new Error();
});
};
};
module.exports = fillTipo;
+25
View File
@@ -0,0 +1,25 @@
const UResponsable = require('../../server/models/tablas/UResponsable');
const faker = require('faker');
faker.locale = 'es_MX';
async function fillUResponsable() {
let unidades = require('./unidades.json');
let nombreResponsable = '';
console.log(`\n\tFilling out with ${ unidades.length } records on uResponsable, please wait...`.cyan.italic.bold);
for (uResponsable of unidades) {
nombreResponsable = faker.name.findName();
await UResponsable.create({
uResponsable,
nombreResponsable
})
.catch(() => {
throw new Error();
});
};
return unidades.length;
};
module.exports = fillUResponsable;
+27
View File
@@ -0,0 +1,27 @@
const Ubicacion = require('../../server/models/tablas/Ubicacion');
const faker = require('faker');
faker.locale = "es_MX";
async function fillUbicacion() {
let ubicaciones = require('./ubicaciones');
let count = 1;
let limit = 15;
console.log('\n\tFilling out «ubicacion».'.cyan.italic.bold);
for (ubicacion of ubicaciones) {
await Ubicacion.create({
ubicacion
})
.then(() => {
console.log(`${ count }/${ limit }\trecords created.`);
count++;
})
.catch(() => {
throw new Error();
});
};
};
module.exports = fillUbicacion;
+24
View File
@@ -0,0 +1,24 @@
const Uso = require('../../server/models/tablas/Uso');
async function fillUso() {
let usos = require('./usos.json');
let count = 1;
let limit = 6;
console.log('\n\tFilling out «uso».'.cyan.italic.bold);
for (uso of usos) {
await Uso.create({
uso
})
.then(() => {
console.log(`${ count }/${ limit }\trecords created.`);
count++;
})
.catch(() => {
throw new Error();
});
};
}
module.exports = fillUso;
+17
View File
@@ -0,0 +1,17 @@
[
"Aula 1",
"Aula 2",
"Aula 3",
"Aula 4",
"Aula 5",
"Aula 6",
"Aula 7",
"Aula 8",
"Aula 9",
"Aula 10",
"Aula 11",
"Aula 12",
"Aula 13",
"Aula 14",
"Aula 15"
]
@@ -70,10 +70,6 @@
"DIVISIÓN DE MATEMÁTICAS E INGENIERÍA",
"DIVISIÓN DEL SISTEMA DE UNIVERSIDAD ABIERTA Y EDUCACIÓN A A DISTANCIA",
"LIBRERÍA UNIVERSITARIA DE LA FES ACATLÁN",
"NO APLICA, LOS BIENES FUERON DADOS DE BAJA",
"PAIDI (DEVOLVER LOS BIENES AL ALMACÉN AL TÉRMINO DEL PROYECTO",
"LOS BIENES DEBEN SER DEVUELTOS AL ALMACÉN AL TERMINAR EL PROYECTO",
"LOS BIENES DEBEN SER DEVUELTOS AL ALMACÉN AL TERMINAR EL PROYECTO",
"PROGRAMA DE ACTUARÍA",
"PROGRAMA DE ARQUITECTURA",
"PROGRAMA DE COMUNICACIÓN",
+1
View File
@@ -0,0 +1 @@
["Analista","Estratega","Especialista","Product Owner","Asistente","Gerente"]
+1 -1
View File
@@ -32,4 +32,4 @@
"gmail-send": "^1.8.10",
"nodemon": "^2.0.4"
}
}
}
+1 -1
View File
@@ -1 +1 @@
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkQWRtaW4iOjQsIm5hbWUiOiJhbGltYSIsInVzZXJOYW1lIjoiQWxmcmVkbyBMaW1hIiwicGFzc3dvcmQiOiIkMmIkMTAka2dFcmlRN1MwbGdsU0YzakdYZ0hEdXNIblNJbFh1T3pHc3JILjR1SGI3N1JLY1c1TUpELksiLCJpc0FkbWluIjp0cnVlLCJjcmVhdGVkQXQiOiIyMDIwLTA4LTI1VDE4OjQ2OjAwLjAwMFoiLCJ1cGRhdGVkQXQiOiIyMDIwLTA4LTI1VDE4OjQ2OjAwLjAwMFoifSwiaWF0IjoxNTk5NDQ0NTA5LCJleHAiOjE1OTk1MzA5MDl9.edj4jwFw0uAyJn92UB6LsuC-STAu0hJC-sb3T0ncReQ
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkQWRtaW4iOjIsIm5hbWUiOiJhbGZyZWRvLmxpbWFAYWNhdGxhbi51bmFtLm14IiwidXNlck5hbWUiOiJBbGZyZWRvIExpbWEiLCJwYXNzd29yZCI6IiQyYiQxMCRrZ0VyaVE3UzBsZ2xTRjNqR1hnSER1c0huU0lsWHVPekdzckguNHVIYjc3UktjVzVNSkQuSyIsImlzQWRtaW4iOmZhbHNlLCJjcmVhdGVkQXQiOiIyMDIwLTA4LTI1VDE4OjQzOjM5LjAwMFoiLCJ1cGRhdGVkQXQiOiIyMDIwLTA4LTI1VDE4OjQzOjM5LjAwMFoifSwiaWF0IjoxNTk5NjAwNjc2LCJleHAiOjE1OTk2ODcwNzZ9.o6fZL839jIktsgd1Y8Xrd8uPMOnhjEv9783PBhl7-Bk
+23
View File
@@ -0,0 +1,23 @@
const activoFijo = require('../../models/tablas/ActivoFijo');
const DescripcionAdicional = require('../../models/tablas/DescripcionAdicional');
const Equipo = require('../../models/tablas/Equipo');
const Inventario = require('../../models/tablas/Inventario');
const Marca = require('../../models/tablas/Marca');
const OS = require('../../models/tablas/OS');
const Printers = require('../../models/tablas/Printers');
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 jwt = require('jsonwebtoken');
const computers = (req, res) => {
// res.json({
// message: "Listo"
// });
}
module.exports = computers;
+26 -8
View File
@@ -2,13 +2,13 @@ const jwt = require('jsonwebtoken');
const verifyToken = (req, res, next) => {
if (typeof localStorage === "undefined" || localStorage === null) {
var LocalStorage = require('node-localstorage').LocalStorage;
localStorage = new LocalStorage('./scratch');
}
let localToken = localStorage.getItem('token');
// if (typeof localStorage === "undefined" || localStorage === null) {
// var LocalStorage = require('node-localstorage').LocalStorage;
// localStorage = new LocalStorage('./scratch');
// }
// let localToken = localStorage.getItem('token');
console.log(localToken);
let localToken = req.get('token');
jwt.verify(localToken, process.env.TOKEN_SEED, (err, decoded) => {
if (err) {
@@ -22,7 +22,25 @@ const verifyToken = (req, res, next) => {
req.user = decoded.user;
next();
})
});
}
module.exports = verifyToken;
const verifyAdmin = (req, res, next) => {
let isAdmin = !!req.user.isAdmin;
if (!isAdmin) {
return res.status(401).json({
err: {
message: 'Is not admin.'
}
})
};
next();
}
module.exports = {
verifyToken,
verifyAdmin
};
+6 -2
View File
@@ -28,8 +28,6 @@ async function remove() {
console.log(logSymbols.success, "impresoras");
await inventario.drop();
console.log(logSymbols.success, "inventario");
await admin.drop();
console.log(logSymbols.success, "admin");
await os.drop();
console.log(logSymbols.success, "os");
await activofijo.drop();
@@ -101,6 +99,12 @@ async function createFirstUsers() {
isAdmin: true
});
await admin.create({
name: 'billie',
userName: 'Billie',
password: bcrypt.hashSync('contraseña', 10)
});
}
async function exec() {
+1
View File
@@ -12,6 +12,7 @@ ActivoFijo.init({
activoFijo: {
type: Sequelize.CHAR,
allowNull: false,
unique: true
},
}, {
sequelize,
+2 -1
View File
@@ -1,3 +1,4 @@
const ActivoFIjo = require("./ActivoFijo");
const Sequelize = require("sequelize");
const sequelize = require("../../config/sequelize.conf");
const Inventario = require("./Inventario");
@@ -56,7 +57,7 @@ Equipo.init({
Inventario.hasOne(Equipo, { foreignKey: 'noInventario' });
Marca.hasOne(Equipo, { foreignKey: 'idMarca' });
DescripcionAdicional.hasOne(Equipo, { foreignKey: 'idDescripcion' });
// DescripcionAdicional.hasOne(Equipo, { foreignKey: 'idDescripcion' });
OS.hasOne(Equipo, { foreignKey: 'idOS' });
module.exports = Equipo;
+1
View File
@@ -13,6 +13,7 @@ Inventario.init({
type: Sequelize.CHAR,
primaryKey: true,
allowNull: false,
unique: true
},
noResguardo: {
type: Sequelize.INTEGER,
+1
View File
@@ -12,6 +12,7 @@ Marca.init({
marca: {
type: Sequelize.CHAR,
allowNull: false,
unique: true
},
}, {
sequelize,
+1
View File
@@ -12,6 +12,7 @@ OS.init({
osname: {
type: Sequelize.CHAR,
allowNull: false,
unique: true
},
}, {
sequelize,
+4
View File
@@ -16,6 +16,10 @@ Printers.init({
type: Sequelize.CHAR,
allowNull: false,
},
// modelo: {
// type: Sequelize.CHAR,
// },
}, {
sequelize,
tableName: "printers",
+1
View File
@@ -12,6 +12,7 @@ Tipo.init({
tipo: {
type: Sequelize.CHAR,
allowNull: false,
unique: true
},
}, {
sequelize,
+1
View File
@@ -12,6 +12,7 @@ UResponsable.init({
uResponsable: {
type: Sequelize.CHAR,
allowNull: false,
unique: true
},
nombreResponsable: {
type: Sequelize.CHAR,
+1
View File
@@ -12,6 +12,7 @@ Ubicacion.init({
ubicacion: {
type: Sequelize.CHAR,
allowNull: false,
unique: true
},
}, {
sequelize,
+1
View File
@@ -12,6 +12,7 @@ Uso.init({
uso: {
type: Sequelize.CHAR,
allowNull: false,
unique: true
},
}, {
sequelize,
+3 -2
View File
@@ -1,6 +1,7 @@
let express = require("express");
let app = express();
app.use(require('./login'))
app.use(require('./login'));
app.use(require('./user'));
module.exports = app
module.exports = app;
+1 -2
View File
@@ -6,7 +6,6 @@ const route = '/login'
//logica del login, ejemplo
let post = require('../controller/login/post');
const Admin = require("../models/tablas/Admin");
//let get = require('../controller/login/get')
app.post(route, async(req, res) => {
@@ -15,4 +14,4 @@ app.post(route, async(req, res) => {
});
module.exports = app
module.exports = app;
+14
View File
@@ -0,0 +1,14 @@
let express = require('express');
let app = express();
const route = '/api/computers';
const computers = require('../controller/api/computers');
const { verifyToken, verifyAdmin } = require('../middlewares/authentication');
app.get(route, verifyToken, (req, res) => {
return computers(req, res);
});
module.exports = app;