-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseed.js
More file actions
72 lines (70 loc) · 1.84 KB
/
seed.js
File metadata and controls
72 lines (70 loc) · 1.84 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
export function seedDatabase(firebase) {
const users = [
{
userId: 'NvPY9M9MzFTARQ6M816YAzDJxZ72',
username: 'karl',
fullName: 'Karl Hadwen',
emailAddress: 'karlhadwen@gmail.com',
following: ['2'],
followers: ['2', '3', '4'],
dateCreated: Date.now()
},
{
userId: '2',
username: 'raphael',
fullName: 'Raffaello Sanzio da Urbino',
emailAddress: 'raphael@sanzio.com',
following: [],
followers: ['NvPY9M9MzFTARQ6M816YAzDJxZ72'],
dateCreated: Date.now()
},
{
userId: '3',
username: 'dali',
fullName: 'Salvador Dalí',
emailAddress: 'salvador@dali.com',
following: [],
followers: ['NvPY9M9MzFTARQ6M816YAzDJxZ72'],
dateCreated: Date.now()
},
{
userId: '4',
username: 'orwell',
fullName: 'George Orwell',
emailAddress: 'george@orwell.com',
following: [],
followers: ['NvPY9M9MzFTARQ6M816YAzDJxZ72'],
dateCreated: Date.now()
}
];
// eslint-disable-next-line prefer-const
for (let k = 0; k < users.length; k++) {
firebase.firestore().collection('users').add(users[k]);
}
// eslint-disable-next-line prefer-const
for (let i = 1; i <= 5; ++i) {
firebase
.firestore()
.collection('photos')
.add({
photoId: i,
userId: '2',
imageSrc: `/images/users/raphael/${i}.jpg`,
caption: 'Saint George and the Dragon',
likes: [],
comments: [
{
displayName: 'dali',
comment: 'Love this place, looks like my animal farm!'
},
{
displayName: 'orwell',
comment: 'Would you mind if I used this picture?'
}
],
userLatitude: '40.7128°',
userLongitude: '74.0060°',
dateCreated: Date.now()
});
}
}