@xuda.io/account_module 1.2.2058 → 1.2.2059
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/get_active_account_profile_info.mjs +19 -0
- package/index_ms.mjs +0 -2
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const get_active_account_profile_info = async function (uid, profile_id) {
|
|
2
|
+
try {
|
|
3
|
+
const acc_obj = await db_module.get_couch_doc_native('xuda_accounts', uid);
|
|
4
|
+
|
|
5
|
+
let active_account_profile_id = profile_id || acc_obj.account_info.active_account_profile_id;
|
|
6
|
+
|
|
7
|
+
const account_profile_obj = await db_module.get_app_couch_doc_native(acc_obj.account_project_id, active_account_profile_id);
|
|
8
|
+
if (account_profile_obj.share_item_id) {
|
|
9
|
+
// set the original profile id if shared
|
|
10
|
+
active_account_profile_id = account_profile_obj.share_item_id;
|
|
11
|
+
}
|
|
12
|
+
const app_id = await get_account_default_project_id(account_profile_obj.shared_from_uid || account_profile_obj.uid);
|
|
13
|
+
|
|
14
|
+
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 };
|
|
15
|
+
} catch (err) {
|
|
16
|
+
console.error('**** get_active_account_profile_info', err);
|
|
17
|
+
debugger;
|
|
18
|
+
}
|
|
19
|
+
};
|
package/index_ms.mjs
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
|
|
9
|
-
//const _ms_broker = await import(path.join(process.env.XUDA_HOME, 'common', 'ms_broker.mjs'));
|
|
10
9
|
const { MessageBroker } = await import(path.join(process.env.XUDA_HOME, 'common', 'ms_broker.mjs'));
|
|
11
10
|
|
|
12
11
|
const broker = new MessageBroker();
|
|
@@ -16,7 +15,6 @@
|
|
|
16
15
|
module_in: global.module_in
|
|
17
16
|
});
|
|
18
17
|
|
|
19
|
-
//_ms_broker.init({queueName:'account_module'})
|
|
20
18
|
|
|
21
19
|
|
|
22
20
|
export const update_account_info = async function (...args) {
|