This repository was archived by the owner on Apr 8, 2024. It is now read-only.
Commit 76012fe 1 parent 6999310 commit 76012fe Copy full SHA for 76012fe
File tree 1 file changed +14
-4
lines changed
1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,14 @@ class Subscriptions {
107
107
}
108
108
109
109
await this . _storage . put ( ids , subscriptionModel )
110
+
111
+ return {
112
+ passthrough : {
113
+ v1 : {
114
+ ids
115
+ }
116
+ }
117
+ }
110
118
}
111
119
112
120
/**
@@ -208,19 +216,21 @@ class Subscriptions {
208
216
/**
209
217
*
210
218
* @param {Object } subscription
219
+ * @param {Date } [atDate=new Date()] date for the calculation
211
220
* @returns {boolean } true subscription is active
212
221
*/
213
- async isSubscriptionActive ( subscription ) {
214
- return this . _isOneOfSubscriptionsActive ( [ subscription ] )
222
+ async isSubscriptionActive ( subscription , atDate = new Date ( ) ) {
223
+ return this . _isOneOfSubscriptionsActive ( [ subscription ] , atDate )
215
224
}
216
225
217
226
/**
218
227
*
219
228
* @param {Array } subscriptions
229
+ * @param {Date } [atDate=new Date()] date for the calculation
220
230
* @returns {boolean } true if an active subscription was given
221
231
*/
222
- async _isOneOfSubscriptionsActive ( subscriptions ) {
223
- const now = Date . now ( )
232
+ async _isOneOfSubscriptionsActive ( subscriptions , atDate ) {
233
+ const now = atDate . getTime ( )
224
234
225
235
const allStatus = subscriptions . map ( subscription => {
226
236
// filter all status object that have a start date in the past
You can’t perform that action at this time.
0 commit comments