-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathchallenge-maintenance.js
More file actions
36 lines (34 loc) · 970 Bytes
/
challenge-maintenance.js
File metadata and controls
36 lines (34 loc) · 970 Bytes
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
export const MEMBERS_COUNT = 1000;
export const START = new Date(2018, 0, 1);
export const END = new Date(2018, 6, 1);
export const AGREEMENT_TYPES = {
1: 'BASIC',
2: 'PLATINUM',
3: 'VIP'
};
export const createCheckIns = () => {
const checkIns = [];
for (let i = 0; i < MEMBERS_COUNT; i++) {
checkIns.push({
memberId: Math.floor(Math.random() * MEMBERS_COUNT) + 1,
date: new Date(start.getTime() + Math.random() * (END.getTime() - START.getTime())).toISOString()
});
}
return JSON.stringify({ data: checkIns });
};
export const createAgreements = () => {
const agreements = [];
const agreementTypesCount = Object.keys(AGREEMENT_TYPES).length;
for (let i = 0; i < MEMBERS_COUNT; i++) {
agreements.push({
memberId: i + 1,
agreement: Math.floor(Math.random() * agreementTypesCount) + 1
});
}
return JSON.stringify({
metadata: {
agreementTypes: AGREEMENT_TYPES
},
data: agreements
});
};