Created
January 24, 2018 08:27
-
-
Save nodtem66/5a7d88495e4bf30b5c45f2854981a924 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* FIREBASE Setup ------------------------------------------------------------*/ | |
const firebaseAdmin = require('firebase-admin'); | |
const firebase = firebaseAdmin.initializeApp({ | |
credential: firebaseAdmin.credential.applicationDefault(), | |
databaseURL: "<URL>" | |
}); | |
const db = firebase.database(); | |
/* END FIREBASE Setup --------------------------------------------------------*/ | |
const cli = require('cli'); | |
const uid = 'zero'; | |
// Step 1. | |
// Create report at /report | |
const newReport = db.ref(`report`).push(); | |
const reportId = newReport.key; | |
newReport.set({ | |
patient: uid, | |
game: 'game-1', | |
staff: 'Mr. Keng Dee3', | |
timestamp: firebaseAdmin.database.ServerValue.TIMESTAMP, | |
results: { | |
"score": [1,1,1,1,1,1], | |
"response-type": [1,0.5,0.3,1,1,1] | |
}, | |
}) | |
.then(() => { | |
cli.ok('success'); | |
firebase.delete(); | |
}).catch(err => { | |
cli.error(err); | |
firebase.delete(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment