-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseed.js
62 lines (60 loc) · 1.76 KB
/
seed.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* eslint-disable no-plusplus */
// NOTE: replace 'NvPY9M9MzFTARQ6M816YAzDJxZ72' with your Firebase auth user id (can be taken from Firebase)
export function seedDatabase(firebase) {
const users = [
{
userId: 'B7kOTqhedxeey25TI3kOp6PRDs82',
fullName: 'Soumik Chaudhuri',
connections: ['3', '4'],
dateCreated: Date.now(),
},
{
userId: '2',
fullName: 'Harsh Gupta',
connections: ['3', '4'],
dateCreated: Date.now(),
},
{
userId: '3',
fullName: 'Pavan Komishitty',
connections: ['B7kOTqhedxeey25TI3kOp6PRDs82', '2'],
dateCreated: Date.now(),
},
{
userId: '4',
fullName: 'Bro Lee',
connections: ['B7kOTqhedxeey25TI3kOp6PRDs82', '2'],
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('posts').add({
postId: i,
userId: 'B7kOTqhedxeey25TI3kOp6PRDs82',
title: 'Mistakes to avoid in college',
body: 'These are the mistakes that I feel should be avoided in college.',
likes: 10,
dislikes: 5,
// comments: [
// {
// displayName: 'dali',
// comment: 'Love this place, looks like my animal farm!',
// },
// {
// displayName: 'orwell',
// comment: 'Would you mind if I used this picture?',
// },
// ],
dateCreated: Date.now(),
});
}
}