@xuda.io/account_module 1.2.1575 → 1.2.1577

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.
Files changed (2) hide show
  1. package/index.mjs +12 -0
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -3132,3 +3132,15 @@ export const add_ai_credits_to_active_accounts = async function () {
3132
3132
  }
3133
3133
  }
3134
3134
  };
3135
+
3136
+ export const run_to_expire_ai_credits = async function () {
3137
+ const _24_hr_ms = 1000 * 60 * 60 * 24;
3138
+ const _mo_ms = _24_hr_ms * 30;
3139
+ const active_ai_credits = await db_module.find_couch_query('xuda_billing', { selector: { stat: 3, docType: 'ai_credit', date_created_ts: { $lt: Date.now() - 100 } }, limit: 99999 });
3140
+ for await (let ai_credit_doc of active_ai_credits.docs) {
3141
+ ai_credit_doc.stat = 5;
3142
+ ai_credit_doc.stat_ts = Date.now();
3143
+ account_doc.last_free_daily_ai_credit_id = ret.data.id;
3144
+ const save_ret = await db_module.save_couch_doc('xuda_accounts', account_doc);
3145
+ }
3146
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1575",
3
+ "version": "1.2.1577",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {