39 lines
1005 B
JavaScript
39 lines
1005 B
JavaScript
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; |