@xuda.io/account_module 1.2.884 → 1.2.886

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 +16 -5
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1617,13 +1617,24 @@ export const get_contacts = async function (req) {
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
- let requests_to = { docs: [] };
1623
- let requests_from = { docs: [] };
1624
- let shared_from = { docs: [] };
1625
- let my_contact = { docs: [] };
1626
- let contact_docs = { docs: [] };
1633
+ let requests_to = { docs: [], total_docs: 0 };
1634
+ let requests_from = { docs: [], total_docs: 0 };
1635
+ let shared_from = { docs: [], total_docs: 0 };
1636
+ let my_contact = { docs: [], total_docs: 0 };
1637
+ let contact_docs = { docs: [], total_docs: 0 };
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.884",
3
+ "version": "1.2.886",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {