@xuda.io/account_module 1.2.885 → 1.2.887
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 +14 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1613,17 +1613,28 @@ export const get_contacts = async function (req) {
|
|
|
1613
1613
|
opt.bookmark = bookmark;
|
|
1614
1614
|
}
|
|
1615
1615
|
|
|
1616
|
-
let contacts = { docs: [] };
|
|
1616
|
+
let contacts = { docs: [], total_docs: 0 };
|
|
1617
1617
|
|
|
1618
1618
|
if (filter_type !== 'pending') {
|
|
1619
1619
|
contacts = await db_module.find_couch_query('xuda_contacts', opt);
|
|
1620
|
+
if (!limit || contact_id) {
|
|
1621
|
+
contacts.total_docs = contacts.docs.length;
|
|
1622
|
+
} else {
|
|
1623
|
+
delete opt.sort;
|
|
1624
|
+
delete opt.skip;
|
|
1625
|
+
opt.limit = 9999;
|
|
1626
|
+
opt.fields = ['_id'];
|
|
1627
|
+
|
|
1628
|
+
const counter = await db_module.find_couch_query('xuda_contacts', opt);
|
|
1629
|
+
contacts.total_docs = counter.docs.length;
|
|
1630
|
+
}
|
|
1620
1631
|
}
|
|
1621
1632
|
|
|
1622
1633
|
let requests_to = { docs: [], total_docs: 0 };
|
|
1623
1634
|
let requests_from = { docs: [], total_docs: 0 };
|
|
1624
1635
|
let shared_from = { docs: [], total_docs: 0 };
|
|
1625
1636
|
let my_contact = { docs: [], total_docs: 0 };
|
|
1626
|
-
let contact_docs = { docs: [], total_docs:
|
|
1637
|
+
let contact_docs = { docs: [], total_docs: contacts.total_docs };
|
|
1627
1638
|
for await (let doc of contacts.docs) {
|
|
1628
1639
|
const ret_to = requests_to.docs.find((e) => {
|
|
1629
1640
|
return e.contact_uid === doc.contact_uid;
|
|
@@ -1638,6 +1649,7 @@ export const get_contacts = async function (req) {
|
|
|
1638
1649
|
doc = await get_contact_info(uid, doc);
|
|
1639
1650
|
contact_docs.docs.push(doc);
|
|
1640
1651
|
}
|
|
1652
|
+
requests_from.total_docs = requests_from.docs.length;
|
|
1641
1653
|
|
|
1642
1654
|
if (!contact_id && with_requests) {
|
|
1643
1655
|
if (filter_type === 'pending') {
|