-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.js
48 lines (41 loc) · 1.05 KB
/
db.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
43
44
45
46
47
48
const Faker = require('faker');
const newImage = {
0: Faker.image.business,
1: Faker.image.cats,
2: Faker.image.city,
3: Faker.image.food,
4: Faker.image.nightlife,
5: Faker.image.fashion,
6: Faker.image.people,
7: Faker.image.nature,
8: Faker.image.animals,
9: Faker.image.imageUrl
};
const getNewImage = index =>
newImage[index % (Object.keys(newImage).length - 1)]();
const user = {
description: Faker.lorem.paragraphs(),
id: 1234,
name: Faker.name.findName(),
thumbnail: Faker.image.avatar()
};
const photo = index => ({
id: Faker.random.uuid(),
thumbnail: getNewImage(index),
user_id: user.id
});
const popular = index => ({
id: Faker.random.uuid(),
thumbnail: getNewImage(index)
});
const MAX_PHOTOS = Math.round(Math.random() * 5) + 3;
const profiles = Array.from(Array(MAX_PHOTOS)).map((_, index) => photo(index));
const MAX_POPULAR = Math.round(Math.random() * 50) + 15;
const populars = Array.from(Array(MAX_POPULAR)).map((_, index) =>
popular(index)
);
module.exports = {
profiles,
populars,
users: [user]
};