2023-08-02 16:43:26 +03:00
|
|
|
const TableImporter = require('./TableImporter');
|
2022-10-26 19:55:08 +03:00
|
|
|
const {faker} = require('@faker-js/faker');
|
|
|
|
const {slugify} = require('@tryghost/string');
|
|
|
|
const {blogStartDate} = require('../utils/blog-info');
|
|
|
|
|
|
|
|
class BenefitsImporter extends TableImporter {
|
2023-02-16 15:11:00 +03:00
|
|
|
static table = 'benefits';
|
2023-08-02 16:43:26 +03:00
|
|
|
static dependencies = [];
|
|
|
|
defaultQuantity = 5;
|
2023-02-16 15:11:00 +03:00
|
|
|
|
2023-08-02 16:43:26 +03:00
|
|
|
constructor(knex, transaction) {
|
|
|
|
super(BenefitsImporter.table, knex, transaction);
|
2022-10-26 19:55:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
generate() {
|
|
|
|
const name = faker.company.catchPhrase();
|
|
|
|
const sixMonthsLater = new Date(blogStartDate);
|
|
|
|
sixMonthsLater.setMonth(sixMonthsLater.getMonth() + 6);
|
|
|
|
return {
|
2024-01-05 16:42:30 +03:00
|
|
|
id: this.fastFakeObjectId(),
|
2022-10-26 19:55:08 +03:00
|
|
|
name: name,
|
|
|
|
slug: `${slugify(name)}-${faker.random.numeric(3)}`,
|
|
|
|
created_at: faker.date.between(blogStartDate, sixMonthsLater)
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = BenefitsImporter;
|