Last active
October 13, 2020 13:06
-
-
Save oligazar/f50b9c37ea8e962a6a2448036a1a3c64 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// jshint esnext:true | |
// "use strict"; | |
// esversion: 6 | |
// https://jsbin.com/yujazob/edit?js | |
// you can see the output in the console (cmd+opt+J) | |
var config = { | |
apiKey: "AIzaSyBVF7jKRrkBl22S03aZy_77m0Q9edXccx8", | |
authDomain: "treckerandroid.firebaseapp.com", | |
databaseURL: "https://treckerandroid.firebaseio.com", | |
projectId: "treckerandroid" | |
}; | |
firebase.initializeApp(config); | |
// for getPositions, getHearBeats | |
var tokenUuid = "78dbc159-a928-43ab-b734-2c0b68eb7027" | |
// for getPolylines, getHearBeats | |
var orderUuid = "e459f53a-36cc-4720-8c79-e2e18168ed3d" | |
function getUser() { | |
console.log("getUser") | |
firebase.database().ref().child("users") | |
.limitToFirst(1) | |
.once('value').then(function(snapshot) { | |
snapshot.forEach(function(snapshot) { | |
console.log(snapshot.val()) | |
}) | |
}) | |
} | |
// path: positions/${token_uuid}/${fb_key}/ | |
// index: orderId, time, epochTime, requestId | |
function getPositions() { | |
console.log("getPositions") | |
firebase.database().ref() | |
.child("positions") | |
.child(tokenUuid) | |
.orderByChild("epochTime") | |
.startAt(1602028800000) | |
.endAt(1602201600000) | |
.once('value').then(function(snapshot) { | |
snapshot.forEach(function(snapshot) { | |
console.log(snapshot.val()) | |
}) | |
}) | |
} | |
// path: new_polys/${order_uuid}/${request_id}/ | |
// index: toTime | |
function getPolylines() { | |
console.log("getPolylines") | |
firebase.database().ref() | |
.child("new_polys") | |
.child(orderUuid) | |
.orderByChild("toTime") | |
// .startAt(1602028800000) | |
// .endAt(1602201600000) | |
// .limitToFirst(1) | |
.once('value').then(function(snapshot) { | |
snapshot.forEach(function(snapshot) { | |
console.log(snapshot.val()) | |
}) | |
}) | |
} | |
// path: heart_beat/${token_uuid}/${order_uuid}/ | |
// index: none | |
function getHearBeats() { | |
console.log("getHearBeats") | |
firebase.database().ref() | |
.child("heart_beat") | |
.child(tokenUuid) | |
.child(orderUuid) | |
// .orderByChild("fromTime") | |
// .startAt(1602028800000) | |
// .endAt(1602201600000) | |
// .limitToFirst(1) | |
.once('value').then(function(snapshot) { | |
snapshot.forEach(function(snapshot) { | |
console.log(snapshot.val()) | |
}) | |
}) | |
} | |
// getPositions() | |
// getPolylines() | |
getHearBeats() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment