-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrite_fs_emulator.js
48 lines (44 loc) · 1.37 KB
/
write_fs_emulator.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 firebase = require('firebase');
const firebaseConfig = {
apiKey: "AIzaSyBrn-GzdCeMBPptk-_Ml3PpXtgbmAP6KZA",
authDomain: "project-coswara.firebaseapp.com",
databaseURL: "https://project-coswara.firebaseio.com",
projectId: "project-coswara",
storageBucket: "project-coswara.appspot.com",
messagingSenderId: "70066812418",
appId: "1:70066812418:web:5deaf3fd2189a19e63d91b",
measurementId: "G-MCWN0Q7MX0"
};
// let firebaseApp = firebase.initializeTestApp({projectId: 'project-coswara', auth: { uid: 'alice'}})
let firebaseApp = firebase.initializeApp(firebaseConfig)
let db = firebaseApp.firestore();
db.settings({
host: "localhost:8080",
ssl: false
});
const dateString = '2020-04-25';
firebase.auth().signInAnonymously().then(() => {
console.log('Logged In')
let user = firebase.auth().currentUser;
console.log('User ID', user.uid)
db.collection("USER_METADATA")
.doc(dateString)
.collection('DATA')
.doc(user.uid).set({
'l_c': 'India',
'l_s': 'Kerala',
'g': 'female',
'covid_status': 'healthy',
'dT': 'web'
}).then(() => {
console.log('Data Added')
});
db.collection("USER_METADATA")
.doc(dateString)
.collection('DATA')
.doc(user.uid).update({
'iF': true
}).then(() => {
console.log('Data Updated')
});
})