-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgenerate.js
42 lines (41 loc) · 1.3 KB
/
generate.js
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
module.exports = function () {
var faker = require("faker")
var _ = require("lodash")
return {
staff: _.times(5, function (n) {
return {
id: n,
name: faker.name.findName(),
email: faker.internet.email(),
phone: faker.phone.phoneNumber(),
role: "baker",
dateOfBirth: faker.date.past(),
avatar: faker.internet.avatar()
}
}),
customers: _.times(20, function (n) {
return {
id: n,
name: faker.name.findName(),
email: faker.internet.email(),
password: faker.internet.password(),
timestamp: faker.date.recent(),
avatar: faker.internet.avatar()
}
}),
orders: _.times(50, function (n) {
return {
id: n,
customerId: _.random(1, 20),
cakes: _.times(_.random(1, 5), function (n) {
return {
cakeId: _.random(1, 16),
quantity: _.random(1, 5)
}
}),
totalPrice: _.random(10, 50),
timestamp: faker.date.recent(),
}
})
}
}