@go-mailer/jarvis 10.10.3 → 10.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/query.js CHANGED
@@ -131,7 +131,10 @@ const buildOrQuery = (value) => {
131
131
  const buildRangeQuery = (value) => {
132
132
  const [min, max] = value.split('~')
133
133
  const is_not_number = !isNaN(min) || !isNaN(max)
134
- const query = {}
134
+ const query = {
135
+ $gte: 0,
136
+ $lte: Number.MAX_SAFE_INTEGER
137
+ }
135
138
 
136
139
  if (is_not_number) {
137
140
  const is_date = !isNaN(Date.parse(min)) || !isNaN(Date.parse(max))
@@ -115,6 +115,11 @@ const WalletThrottler = async ({
115
115
  }
116
116
  }
117
117
 
118
+ const refreshCache = async ({ tenant_id, wallet_type, balance }) => {
119
+ const balance_key = `wallet:tenant:${tenant_id}:wallet:${wallet_type}`
120
+ await redisClient.set(balance_key, balance * 100) // Store as integer (cents)
121
+ }
122
+
118
123
  const refundCredits = async ({
119
124
  tenant_id,
120
125
  wallet_type,
@@ -168,6 +173,7 @@ const WalletThrottler = async ({
168
173
  getWalletRate,
169
174
  loadCache,
170
175
  refundCredits,
176
+ refreshCache,
171
177
  topUpCredits
172
178
  }
173
179
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-mailer/jarvis",
3
- "version": "10.10.3",
3
+ "version": "10.10.5",
4
4
  "main": "index.js",
5
5
  "repository": "git@github.com:go-mailer-ltd/jarvis-node.git",
6
6
  "author": "Nathan Oguntuberu <nateoguns.work@gmail.com>",