mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 09:52:06 +03:00
b8f59f07f2
no issue
27 lines
815 B
JavaScript
27 lines
815 B
JavaScript
const TableImporter = require('./base');
|
|
const {faker} = require('@faker-js/faker');
|
|
const {slugify} = require('@tryghost/string');
|
|
const {blogStartDate} = require('../utils/blog-info');
|
|
|
|
class BenefitsImporter extends TableImporter {
|
|
static table = 'benefits';
|
|
|
|
constructor(knex) {
|
|
super(BenefitsImporter.table, knex);
|
|
}
|
|
|
|
generate() {
|
|
const name = faker.company.catchPhrase();
|
|
const sixMonthsLater = new Date(blogStartDate);
|
|
sixMonthsLater.setMonth(sixMonthsLater.getMonth() + 6);
|
|
return {
|
|
id: faker.database.mongodbObjectId(),
|
|
name: name,
|
|
slug: `${slugify(name)}-${faker.random.numeric(3)}`,
|
|
created_at: faker.date.between(blogStartDate, sixMonthsLater)
|
|
};
|
|
}
|
|
}
|
|
|
|
module.exports = BenefitsImporter;
|