mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 05:14:12 +03:00
d2cb23c3fa
ref PROD-233 - Stored whether Docker is used in the config files - When running `yarn setup`, any existing Docker container will be reset. Run with `-y` to skip the confirmation step. - `yarn setup` will always init the database and generate fake data - Increased amount of default generated data to 100,000 members + 500 posts. - Made lots of performance improvements in the data generator so we can generate the default data in ±170s
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
const TableImporter = require('./TableImporter');
|
|
const {faker} = require('@faker-js/faker');
|
|
|
|
function capitalize(str) {
|
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
}
|
|
|
|
class RecommendationsImporter extends TableImporter {
|
|
static table = 'recommendations';
|
|
static dependencies = [];
|
|
defaultQuantity = 15;
|
|
|
|
constructor(knex, transaction) {
|
|
super(RecommendationsImporter.table, knex, transaction);
|
|
}
|
|
|
|
generate() {
|
|
const id = this.fastFakeObjectId();
|
|
return {
|
|
id,
|
|
url: faker.internet.url(),
|
|
title: capitalize(`${faker.word.adjective()} ${faker.word.noun()}`),
|
|
excerpt: faker.lorem.sentence(),
|
|
featured_image: `https://api.dicebear.com/5.x/shapes/png?size=256&seed=${id}`,
|
|
favicon: `https://api.dicebear.com/5.x/shapes/png?size=32&seed=${id}`,
|
|
description: faker.lorem.sentence(),
|
|
one_click_subscribe: faker.datatype.boolean(),
|
|
created_at: faker.date.past(),
|
|
updated_at: faker.date.past()
|
|
};
|
|
}
|
|
}
|
|
|
|
module.exports = RecommendationsImporter;
|