@xuda.io/account_module 1.2.1338 → 1.2.1340
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/index.mjs +8 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -592,7 +592,7 @@ export const get_active_account_profile_info = async function (uid, profile_id)
|
|
|
592
592
|
}
|
|
593
593
|
const app_id = await get_account_default_project_id(account_profile_obj.shared_from_uid || account_profile_obj.uid);
|
|
594
594
|
|
|
595
|
-
return { uid: account_profile_obj.shared_from_uid || uid, account_profile_id: active_account_profile_id, app_id, is_main:
|
|
595
|
+
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 };
|
|
596
596
|
};
|
|
597
597
|
|
|
598
598
|
export const get_account_name = async function (req) {
|
|
@@ -2045,9 +2045,9 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2045
2045
|
};
|
|
2046
2046
|
|
|
2047
2047
|
export const get_contacts = async function (req) {
|
|
2048
|
-
const { _id, uid, name, limit, skip, bookmark, search, filter_type = 'all', contact_id } = req;
|
|
2048
|
+
const { _id, uid, name, limit, skip, bookmark, search, filter_type = 'all', contact_id, profile_id } = req;
|
|
2049
2049
|
try {
|
|
2050
|
-
const account_profile_info = await get_active_account_profile_info(uid);
|
|
2050
|
+
const account_profile_info = await get_active_account_profile_info(uid, profile_id);
|
|
2051
2051
|
if (_id) {
|
|
2052
2052
|
let data = { code: 34, data: await get_contact(uid, _id) };
|
|
2053
2053
|
return data;
|
|
@@ -2065,6 +2065,10 @@ export const get_contacts = async function (req) {
|
|
|
2065
2065
|
sort: [{ ts: 'desc' }],
|
|
2066
2066
|
};
|
|
2067
2067
|
|
|
2068
|
+
if (!account_profile_info.is_main) {
|
|
2069
|
+
opt.selector.account_profiles = { $in: [account_profile_info.account_profile_id] };
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2068
2072
|
switch (filter_type) {
|
|
2069
2073
|
case 'archived': {
|
|
2070
2074
|
opt.selector.stat = 5;
|
|
@@ -2776,10 +2780,9 @@ export const update_account_profile = async function (req, job_id, headers) {
|
|
|
2776
2780
|
};
|
|
2777
2781
|
|
|
2778
2782
|
export const update_entity_account_profiles = async function (req, job_id, headers) {
|
|
2779
|
-
const { uid, _id, account_profiles } = req;
|
|
2783
|
+
const { uid, _id, account_profiles = [] } = req;
|
|
2780
2784
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2781
2785
|
|
|
2782
|
-
// let save_ret;
|
|
2783
2786
|
try {
|
|
2784
2787
|
let doc = await db_module.get_app_couch_doc_native(app_id, _id);
|
|
2785
2788
|
|