forked from cribbl/miteb-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.js
218 lines (210 loc) · 5.8 KB
/
setup.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
const admin = require('firebase-admin')
// shall change the path based on env later
const serviceAccount = require('./config.json')
// shall change the dbURL based on env later
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: '<your_firebase_project_databaseURL>'
})
const users = [
{
uid: 'associatedirector',
email: '[email protected]',
password: 'Password@1234',
emailVerified: true
},
{
uid: 'dumm408',
email: '[email protected]',
password: 'Password@1234',
emailVerified: true
},
{
uid: 'dumm408FA',
email: '[email protected]',
password: 'Password@1234',
emailVerified: true
},
{
uid: 'securityofficer',
email: '[email protected]',
password: 'Password@1234',
emailVerified: true
},
{
uid: 'studentcouncil',
email: '[email protected]',
password: 'Password@1234',
emailVerified: true
}
]
let addBasicUsers = () => {
users.forEach(user => {
admin.auth().createUser(user)
.then((user) => {
console.log(user.uid + ' created.')
})
.catch((err) => {
console.log(err.errorInfo)
console.log(user.uid + ' failed to create.')
})
})
}
addBasicUsers()
const BASIC_DB_DATA = {
'developers': {
'arushi': {
'facebook': 'https://www.facebook.com/',
'github': 'https://github.com/',
'name': 'Some Developer',
'pos': 0,
'profilePicURL': 'https://cdn.dribbble.com/users/244753/screenshots/3959959/nespresso.gif',
'role': 'Front End Developer'
},
'backendDeveloper': {
'description': 'We are looking for a developers interested in the Back End of an application to join our organization. You’ll be responsible for programming the code in computing languages to inform a website on how it is supposed to function.You will be working on Node.js, Firebase admin, AWS, Express JS, and best practices of client-server architecture.',
'name': 'Back End Developer',
'openPosition': true,
'pos': 1,
'profilePicURL': 'https://firebasestorage.googleapis.com/v0/b/mit-clubs-management.appspot.com/o/developers%2Fprogrammer.gif?alt=media&token=9a6c2168-f9fc-4e3e-8442-9db4fa9af269',
'role': '2 Open Positions'
}
},
'disabledDates': ['27-08-2018', '28-08-2018'],
'events': {
'dummfoss344421': {
'AD_appr': 'NA',
'FA_appr': 'pending',
'FA_name': 'Fac Ad Pai',
'SO_appr': 'NA',
'booker_contact': '7760627296',
'booker_email': '[email protected]',
'booker_name': 'Bhawesh Bhansali',
'booker_reg_no': '150911124',
'clubEmail': '[email protected]',
'clubID': 'dumm408',
'clubName': 'Dummy MIT Club',
'desc': 'A workshop on Open Source',
'endDate': '19-12-2018',
'end_time': '7:45pm',
'rooms': [5201, 5202],
'startDate': '18-12-2018',
'start_time': '5:45pm',
'title': 'FOSS Workshop',
'type': 'External'
}
},
'roomsx': {
'18-12-2018': [5201, 5202],
'19-12-2018': [5201, 5202]
},
'to-be-held': {
'18-12-2018': {
'-LTpJcdAjTpHofKXN3O2': 'dummfoss344421'
},
'19-12-2018': {
'-LTpJcdBUWHmO4aA5_jo': 'dummfoss344421'
}
},
'users': {
'associatedirector': {
'abbrv': 'AD',
'email': '[email protected]',
'emailVerification': true,
'isAD': true,
'isApproved': true,
'name': 'Narayana Shenoy',
'nameAbbrv': 'AD',
'notificationSettings': {
'email': 1,
'sms': 1
},
'primaryContact': '7760627296',
'uid': 'associatedirector'
},
'dumm408': {
'abbrv': 'dummymitclub',
'category': 'technical',
'email': '[email protected]',
'emailVerification': true,
'fa': {
'name': 'Fac Ad Pai'
},
'fa_uid': 'dumm408FA',
'isApproved': true,
'isClub': true,
'isFA': false,
'my_events': {
'-LTpJcYBub90RM7THtKe': 'dummfoss344421'
},
'name': 'Dummy MIT Club',
'notificationSettings': {
'email': 1,
'sms': 0
},
'primaryContact': '7760627296',
'uid': 'dumm408'
},
'dumm408FA': {
'abbrv': 'FA',
'category': 'technical',
'clubID': 'dumm408',
'email': '[email protected]',
'emailVerification': true,
'isApproved': true,
'isFA': true,
'name': 'Fac Ad Pai',
'nameAbbrv': 'FA',
'notificationSettings': {
'email': 1,
'sms': 0
},
'primaryContact': '7760627296',
'uid': 'dumm408FA'
},
'securityofficer': {
'abbrv': 'SO',
'email': '[email protected]',
'emailVerification': true,
'isApproved': true,
'isSO': true,
'name': 'Ashok Rao',
'nameAbbrv': 'SO',
'notificationSettings': {
'email': 1,
'sms': 1
},
'primaryContact': '7760627296',
'uid': 'securityofficer'
},
'studentcouncil': {
'abbrv': 'SCM',
'category': 'council',
'email': '[email protected]',
'emailVerification': true,
'fa': {
'name': 'Narayana Shenoy'
},
'fa_uid': 'associatedirector',
'isApproved': true,
'isClub': true,
'isSC': true,
'name': 'Student Council',
'nameAbbrv': 'SC',
'notificationSettings': {
'email': 1,
'sms': 1
},
'primaryContact': '7760627296',
'profilePicURL': 'https://firebasestorage.googleapis.com/v0/b/staging-mit-event-booking.appspot.com/o/studentcouncil%2FprofilePic?alt=media&token=eae6e034-f8dd-489d-8ee9-f16401a36913',
'uid': 'studentcouncil'
}
}
}
let addBasicDb = async () => {
await admin.database().ref().set(BASIC_DB_DATA)
.then(() => console.log('Succeeded'))
.catch(() => console.log('Failed'))
process.exit()
}
addBasicDb()