mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 18:52:14 +03:00
Added random expiry date for complimentary subscriptions in data generator
ref PROD-244
This commit is contained in:
parent
e1ef7c44d8
commit
5351b88b59
@ -1,6 +1,7 @@
|
||||
const {faker} = require('@faker-js/faker');
|
||||
const TableImporter = require('./TableImporter');
|
||||
const {luck} = require('../utils/random');
|
||||
const dateToDatabaseString = require('../utils/database-date');
|
||||
|
||||
class MembersProductsImporter extends TableImporter {
|
||||
static table = 'members_products';
|
||||
@ -32,7 +33,8 @@ class MembersProductsImporter extends TableImporter {
|
||||
id: faker.database.mongodbObjectId(),
|
||||
member_id: this.model.id,
|
||||
product_id: this.getProduct().id,
|
||||
sort_order: 0
|
||||
sort_order: 0,
|
||||
expiry_at: this.model.status === 'paid' ? null : (luck(50) ? null : dateToDatabaseString(faker.date.future()))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user