Skip to content

Commit

Permalink
chore: set date to expire
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusgnreis committed Jan 24, 2024
1 parent 2d36598 commit bf58c13
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions functions/lib/bling-auth/create-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module.exports = function (clientId, clientSecret, code, storeId) {
storeId,
clientId,
clientSecret,
expiredAt: Timestamp.fromMillis(now + ((res.data.expires_in - 300) * 1000)),
updatedAt: Timestamp.now()
}).catch(console.error)
}
Expand Down
4 changes: 2 additions & 2 deletions functions/lib/bling-auth/renovate-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ module.exports = async () => {
const db = getFirestore()
const d = new Date(new Date().getTime() + 7200000)
const documentSnapshot = await db.collection(firestoreColl)
.where('expiredAt', '<=', d)
.orderBy('expiredAt')
.where('updatedAt', '<=', d)
.orderBy('updatedAt')
.get()
const { docs } = documentSnapshot
const maxExistedDocs = docs && docs.length > maxDocs
Expand Down

0 comments on commit bf58c13

Please sign in to comment.