Skip to content

Instantly share code, notes, and snippets.

@nodtem66
Created January 24, 2018 08:27
Show Gist options
  • Save nodtem66/5a7d88495e4bf30b5c45f2854981a924 to your computer and use it in GitHub Desktop.
Save nodtem66/5a7d88495e4bf30b5c45f2854981a924 to your computer and use it in GitHub Desktop.
/* 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