@xuda.io/account_module 1.2.1593 → 1.2.1595

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 +15 -10
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -589,18 +589,23 @@ export const get_account_info = async function (req) {
589
589
  };
590
590
 
591
591
  export const get_active_account_profile_info = async function (uid, profile_id) {
592
- const acc_obj = await db_module.get_couch_doc_native('xuda_accounts', uid);
592
+ try {
593
+ const acc_obj = await db_module.get_couch_doc_native('xuda_accounts', uid);
593
594
 
594
- let active_account_profile_id = profile_id || acc_obj.account_info.active_account_profile_id;
595
+ let active_account_profile_id = profile_id || acc_obj.account_info.active_account_profile_id;
595
596
 
596
- const account_profile_obj = await db_module.get_app_couch_doc_native(acc_obj.account_project_id, active_account_profile_id);
597
- if (account_profile_obj.share_item_id) {
598
- // set the original profile id if shared
599
- active_account_profile_id = account_profile_obj.share_item_id;
600
- }
601
- const app_id = await get_account_default_project_id(account_profile_obj.shared_from_uid || account_profile_obj.uid);
597
+ const account_profile_obj = await db_module.get_app_couch_doc_native(acc_obj.account_project_id, active_account_profile_id);
598
+ if (account_profile_obj.share_item_id) {
599
+ // set the original profile id if shared
600
+ active_account_profile_id = account_profile_obj.share_item_id;
601
+ }
602
+ const app_id = await get_account_default_project_id(account_profile_obj.shared_from_uid || account_profile_obj.uid);
602
603
 
603
- return { uid: account_profile_obj.shared_from_uid || uid, account_profile_id: active_account_profile_id, app_id, is_main: active_account_profile_id === acc_obj.account_profile_id, account_profile_obj };
604
+ return { uid: account_profile_obj.shared_from_uid || uid, account_profile_id: active_account_profile_id, app_id, is_main: active_account_profile_id === acc_obj.account_profile_id, account_profile_obj };
605
+ } catch (err) {
606
+ console.error(err);
607
+ debugger;
608
+ }
604
609
  };
605
610
 
606
611
  export const get_account_name = async function (req) {
@@ -3122,7 +3127,7 @@ export const add_ai_credits_to_active_accounts = async function () {
3122
3127
  });
3123
3128
 
3124
3129
  const _24_hr_ms = 1000 * 60 * 60 * 24;
3125
- const active_accounts = await db_module.find_couch_query('xuda_accounts', { selector: { stat: 3, docType: 'account', last_free_daily_ai_credit_ts: { $lt: Date.now() - _24_hr_ms }, membership_plan: 'free' }, limit: 99999 });
3130
+ const active_accounts = await db_module.find_couch_query('xuda_accounts', { selector: { stat: 3, docType: 'account', last_free_daily_ai_credit_ts: { $lt: Date.now() - _24_hr_ms }, ai_workspace_plan: 'free_ai_workspace' }, limit: 99999 });
3126
3131
  for await (let account_doc of active_accounts.docs) {
3127
3132
  const ret = await record_ai_credit('system', 1, 'daily credit', 'free daily credit ' + date_str, account_doc._id);
3128
3133
  if (ret.code > -1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1593",
3
+ "version": "1.2.1595",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {