Data generator: Ensure order of newsletters is correct
no issue
This commit is contained in:
parent
4ff467794f
commit
356256067c
@ -14,7 +14,7 @@ class EmailsImporter extends TableImporter {
|
||||
|
||||
async import(quantity) {
|
||||
const posts = await this.transaction.select('id', 'title', 'published_at').from('posts').where('type', 'post');
|
||||
this.newsletters = await this.transaction.select('id').from('newsletters');
|
||||
this.newsletters = await this.transaction.select('id').from('newsletters').orderBy('sort_order');
|
||||
this.membersSubscribeEvents = await this.transaction.select('id', 'newsletter_id', 'created_at').from('members_subscribe_events');
|
||||
|
||||
await this.importForEach(posts, quantity ? quantity / posts.length : 1);
|
||||
|
@ -70,7 +70,7 @@ class MembersImporter extends TableImporter {
|
||||
return {
|
||||
id,
|
||||
uuid: faker.datatype.uuid(),
|
||||
email: faker.internet.email(name, faker.date.birthdate().getFullYear().toString(), 'example.com').toLowerCase(),
|
||||
email: `${name.replace(' ', '.').replace(/[^a-zA-Z0-9]/g, '').toLowerCase()}${faker.datatype.number({min: 1000, max: 9999})}@example.com`,
|
||||
status: luck(5) ? 'comped' : luck(25) ? 'paid' : 'free',
|
||||
name: name,
|
||||
expertise: luck(30) ? faker.name.jobTitle() : undefined,
|
||||
|
@ -13,7 +13,7 @@ class MembersSubscribeEventsImporter extends TableImporter {
|
||||
|
||||
async import(quantity) {
|
||||
const members = await this.transaction.select('id', 'created_at', 'status').from('members');
|
||||
this.newsletters = await this.transaction.select('id').from('newsletters');
|
||||
this.newsletters = await this.transaction.select('id').from('newsletters').orderBy('sort_order');
|
||||
this.subscriptions = await this.transaction.select('member_id', 'created_at').from('subscriptions');
|
||||
|
||||
await this.importForEach(members, quantity ? quantity / members.length : 2);
|
||||
|
@ -19,7 +19,7 @@ class PostsImporter extends TableImporter {
|
||||
}
|
||||
|
||||
async import(quantity = this.defaultQuantity) {
|
||||
this.newsletters = await this.transaction.select('id').from('newsletters');
|
||||
this.newsletters = await this.transaction.select('id').from('newsletters').orderBy('sort_order');
|
||||
|
||||
await super.import(quantity);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user