2022-09-23 20:15:08 +03:00
|
|
|
import moment from 'moment-timezone';
|
2022-03-08 14:32:01 +03:00
|
|
|
import {Factory} from 'miragejs';
|
2024-07-01 15:22:11 +03:00
|
|
|
import {faker} from '@faker-js/faker';
|
2021-10-08 17:15:48 +03:00
|
|
|
|
|
|
|
let randomDate = function randomDate(start = moment().subtract(30, 'days').toDate(), end = new Date()) {
|
|
|
|
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Factory.extend({
|
|
|
|
name() { return `${faker.name.firstName()} ${faker.name.lastName()}`; },
|
2021-10-19 10:51:11 +03:00
|
|
|
amount() { return faker.datatype.number({min: 1, max: 10}); },
|
|
|
|
displayTitle() { return faker.lorem.word(); },
|
|
|
|
code() { return faker.lorem.slug(); },
|
2021-10-20 16:14:38 +03:00
|
|
|
createdAt() { return randomDate(); },
|
|
|
|
tier() {
|
|
|
|
return {
|
|
|
|
id: '1'
|
|
|
|
};
|
|
|
|
}
|
2021-10-08 17:15:48 +03:00
|
|
|
});
|