-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathgroup.ts
47 lines (33 loc) · 1.39 KB
/
group.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import {GroupCreator} from '@data/types/group';
import {faker} from '@faker-js/faker';
const priceDisplayMethod: string[] = ['Tax included', 'Tax excluded'];
/**
* Create new group to use on creation form on group page on BO
* @class
*/
export default class GroupData {
public readonly id: number;
public readonly name: string;
public readonly frName: string;
public readonly discount: number;
public readonly priceDisplayMethod: string;
public readonly shownPrices: boolean;
/**
* Constructor for class GroupData
* @param groupToCreate {GroupCreator} Could be used to force the value of some members
*/
constructor(groupToCreate: GroupCreator = {}) {
/** @type {number} ID of the group */
this.id = groupToCreate.id || 0;
/** @type {string} Name of the group */
this.name = groupToCreate.name || faker.person.jobType();
/** @type {string} French name of the group */
this.frName = groupToCreate.frName || this.name;
/** @type {number} Basic discount for the group */
this.discount = groupToCreate.discount || 0;
/** @type {string} Price display method of the group */
this.priceDisplayMethod = groupToCreate.priceDisplayMethod || faker.helpers.arrayElement(priceDisplayMethod);
/** @type {boolean} True to show prices for the group */
this.shownPrices = groupToCreate.shownPrices === undefined ? true : groupToCreate.shownPrices;
}
}