From f57a95c4497bf3dc812d97fc2583638b405170ee Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Sun, 12 Apr 2020 18:50:40 +0000 Subject: [PATCH] vrch --- functions/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/index.js b/functions/index.js index b168c4b..ae2cdbd 100644 --- a/functions/index.js +++ b/functions/index.js @@ -11,9 +11,9 @@ const MAX_NOTIFICATIONS_PER_DAY = 50; exports.sendPushNotification = functions.https.onRequest(async (req, res) => { if (debug()) console.log('Received payload', req.body); - var today = getToday(); + var currentRateLimitDocName = getCurrentRateLimitsDocName(); var token = req.body.push_token; - var ref = db.collection('rateLimits').doc(today).collection('tokens').doc(token); + var ref = db.collection('rateLimits').doc(currentRateLimitDocName).collection('tokens').doc(token); var payload = { notification: { @@ -133,7 +133,7 @@ function handleError(res, step, incomingError) { }); } -function getToday() { +function getCurrentRateLimitsDocName() { var today = new Date(); var dd = String(today.getDate()).padStart(2, '0'); var mm = String(today.getMonth() + 1).padStart(2, '0');