@xuda.io/account_module 1.2.1034 → 1.2.1035
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 +1 -15
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2568,20 +2568,16 @@ export const get_profiles = async function (req) {
|
|
|
2568
2568
|
opt.limit = 9999;
|
|
2569
2569
|
opt.fields = ['_id'];
|
|
2570
2570
|
|
|
2571
|
-
const counter = await db_module.find_couch_query('
|
|
2571
|
+
const counter = await db_module.find_couch_query('xuda_accounts', opt);
|
|
2572
2572
|
profiles.total_docs = counter.docs.length;
|
|
2573
2573
|
}
|
|
2574
2574
|
}
|
|
2575
2575
|
|
|
2576
|
-
let requests_to = { docs: [], total_docs: 0 };
|
|
2577
2576
|
let requests_from = { docs: [], total_docs: 0 };
|
|
2578
2577
|
let shared_from = { docs: [], total_docs: 0 };
|
|
2579
2578
|
let my_contact = { docs: [], total_docs: 0 };
|
|
2580
2579
|
let contact_docs = { docs: [], total_docs: profiles.total_docs };
|
|
2581
2580
|
for await (let doc of profiles.docs) {
|
|
2582
|
-
const ret_to = requests_to.docs.find((e) => {
|
|
2583
|
-
return e.contact_uid === doc.contact_uid;
|
|
2584
|
-
});
|
|
2585
2581
|
if (ret_to) continue;
|
|
2586
2582
|
|
|
2587
2583
|
const ret_from = requests_from.docs.find((e) => {
|
|
@@ -2600,22 +2596,12 @@ export const get_profiles = async function (req) {
|
|
|
2600
2596
|
|
|
2601
2597
|
if (!profile_id) {
|
|
2602
2598
|
if (filter_type === 'pending') {
|
|
2603
|
-
////// TO - OUT
|
|
2604
|
-
requests_to.docs = await get_pending_contact_out(uid);
|
|
2605
|
-
requests_to.total_docs = requests_to.docs.length;
|
|
2606
|
-
|
|
2607
2599
|
////// FROM - IN
|
|
2608
2600
|
requests_from.docs = await get_pending_contact_in(uid);
|
|
2609
2601
|
requests_from.total_docs = requests_from.docs.length;
|
|
2610
2602
|
shared_from.docs = await get_pending_share_contact_in(uid);
|
|
2611
2603
|
shared_from.total_docs = shared_from.docs.length;
|
|
2612
2604
|
}
|
|
2613
|
-
// my contact
|
|
2614
|
-
if (filter_type === 'all' && !search && contact_docs.docs.length) {
|
|
2615
|
-
const my_contact_doc = await get_user_contact(uid, uid);
|
|
2616
|
-
my_contact.docs = [my_contact_doc];
|
|
2617
|
-
my_contact.total_docs = 1;
|
|
2618
|
-
}
|
|
2619
2605
|
}
|
|
2620
2606
|
|
|
2621
2607
|
return {
|