add more filtering

This commit is contained in:
Andrew
2023-03-13 11:42:24 +00:00
parent 62c4d674d2
commit 4007bcf0b9
2 changed files with 64 additions and 70 deletions

View File

@ -81,7 +81,7 @@ exports.postStationData = functions.https.onRequest((request, response) => {
// store all dart codes into a hashset
// compare these with the station call with code "all" to avoid duplicates
let dartCodes = new Set()
batchWriteDB(request, response, db, jsonData, dartCodes, "Dart")
batchWriteDB(request, response, db, jsonData, dartCodes, "DART")
// populate the dartCodes hashset
jsonData.forEach((doc) => {
@ -186,7 +186,7 @@ exports.postLiveTrainData = functions.https.onRequest((request, response) => {
axios.get('https://api.irishrail.ie/realtime/realtime.asmx/getCurrentTrainsXML_WithTrainType?TrainType=D').then(res => {
parseString(res.data, function(err, result) {
let jsonData = parseJSON(result)
batchWriteDB(request, response, db, jsonData, "Dart");
batchWriteDB(request, response, db, jsonData, "DART");
response.send({data: "Successfully fetched and uploaded live train data from Irish Rail"});
})
})
@ -208,4 +208,4 @@ exports.securefunction = functions.https.onCall((data, context) => {
// user logged in
return "User is logged in"
}
})
})