@xuda.io/account_module 1.2.1682 → 1.2.1684

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 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1290,7 +1290,20 @@ export const get_contact_info = async function (uid, contact_doc, _id) {
1290
1290
  endkey: [doc._id, 'zzzzzz'],
1291
1291
  });
1292
1292
 
1293
- return counts_ret?.rows?.[0]?.value || [0, 0];
1293
+ return counts_ret?.rows?.[0]?.value || 0;
1294
+ };
1295
+ const chat_conversation_read = async function () {
1296
+ const account_profile_info = await get_active_account_profile_info(uid);
1297
+
1298
+ const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_read', {
1299
+ reduce: true,
1300
+ group_level: 2,
1301
+
1302
+ startkey: [uid, doc._id, ''],
1303
+ endkey: [uid, doc._id, 'zzzzzz'],
1304
+ });
1305
+
1306
+ return counts_ret?.rows?.[0]?.value || 0;
1294
1307
  };
1295
1308
  const contact_chat_conversation_count_ret = await chat_conversation_count();
1296
1309
  doc.notifications = 0;
@@ -1360,8 +1373,8 @@ export const get_contact_info = async function (uid, contact_doc, _id) {
1360
1373
  doc.email = doc.email;
1361
1374
  }
1362
1375
 
1363
- doc.interactions = contact_chat_conversation_count_ret[0];
1364
- doc.notifications = contact_chat_conversation_count_ret[0] - contact_chat_conversation_count_ret[1];
1376
+ doc.interactions = contact_chat_conversation_count_ret;
1377
+ doc.notifications = contact_chat_conversation_count_ret;
1365
1378
  doc.chats = doc.interactions;
1366
1379
 
1367
1380
  // const chats_ret = await ai_module.get_ai_chats({ uid, reference_id: doc._id });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1682",
3
+ "version": "1.2.1684",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {