Files
censo2020Back/helpers/tables/UResponsable.js
T
2020-09-10 03:06:23 -05:00

25 lines
721 B
JavaScript

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;