-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ariya Hidayat
committed
Apr 8, 2020
1 parent
2bb67e7
commit c7dfb0d
Showing
5 changed files
with
56 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"indexes": [], | ||
"fieldOverrides": [] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
rules_version = '2'; | ||
service cloud.firestore { | ||
match /databases/{database}/documents { | ||
match /{document=**} { | ||
allow read, write: if false; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
const admin = require('firebase-admin'); | ||
const functions = require('firebase-functions'); | ||
|
||
exports.ping = functions.https.onRequest((request, response) => { | ||
response.send(`OK ${Date.now()}`); | ||
}); | ||
|
||
admin.initializeApp(functions.config().firebase); | ||
const db = admin.firestore(); | ||
|
||
exports.showJobCounter = functions.https.onRequest(async (request, response) => { | ||
try { | ||
var doc = await db.collection('jobConfig').doc('counter').get(); | ||
var counter = doc.data().value; | ||
console.log(`Counter is ${counter}`); | ||
response.send(`Counter is ${counter}`); | ||
} catch (err) { | ||
console.error(`Failed to obtain the counter: ${err.toString()}`); | ||
response.send(`EXCEPTION: ${err.toString()}`); | ||
} | ||
}); |
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