mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 11:22:19 +03:00
b8f59f07f2
no issue
30 lines
967 B
JavaScript
30 lines
967 B
JavaScript
const TableImporter = require('./base');
|
|
const {faker} = require('@faker-js/faker');
|
|
const {slugify} = require('@tryghost/string');
|
|
const security = require('@tryghost/security');
|
|
const dateToDatabaseString = require('../utils/database-date');
|
|
|
|
class UsersImporter extends TableImporter {
|
|
static table = 'users';
|
|
|
|
constructor(knex) {
|
|
super(UsersImporter.table, knex);
|
|
}
|
|
|
|
async generate() {
|
|
const name = `${faker.name.firstName()} ${faker.name.lastName()}`;
|
|
return {
|
|
id: faker.database.mongodbObjectId(),
|
|
name: name,
|
|
slug: slugify(name),
|
|
password: await security.password.hash(faker.color.human()),
|
|
email: faker.internet.email(name),
|
|
profile_image: faker.internet.avatar(),
|
|
created_at: dateToDatabaseString(faker.date.between(new Date(2016, 0), new Date())),
|
|
created_by: 'unused'
|
|
};
|
|
}
|
|
}
|
|
|
|
module.exports = UsersImporter;
|