@xuda.io/account_module 1.2.2132 → 1.2.2134

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 +60 -25
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1274,32 +1274,32 @@ export const get_contact_info = async function (uid, contact_doc, _id) {
1274
1274
  delete doc.profile_picture_obj;
1275
1275
  delete doc.bio;
1276
1276
 
1277
- const chat_conversation_count = async function () {
1278
- const account_profile_info = await get_active_account_profile_info(uid);
1277
+ // const chat_conversation_count = async function () {
1278
+ // const account_profile_info = await get_active_account_profile_info(uid);
1279
1279
 
1280
- const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_counts', {
1281
- reduce: true,
1282
- group_level: 1,
1280
+ // const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_counts', {
1281
+ // reduce: true,
1282
+ // group_level: 1,
1283
1283
 
1284
- startkey: [doc._id, ''],
1285
- endkey: [doc._id, 'zzzzzz'],
1286
- });
1284
+ // startkey: [doc._id, ''],
1285
+ // endkey: [doc._id, 'zzzzzz'],
1286
+ // });
1287
1287
 
1288
- return counts_ret?.rows?.[0]?.value || 0;
1289
- };
1290
- const chat_conversation_read = async function () {
1291
- const account_profile_info = await get_active_account_profile_info(uid);
1288
+ // return counts_ret?.rows?.[0]?.value || 0;
1289
+ // };
1290
+ // const chat_conversation_read = async function () {
1291
+ // const account_profile_info = await get_active_account_profile_info(uid);
1292
1292
 
1293
- const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_read', {
1294
- reduce: true,
1295
- group_level: 2,
1293
+ // const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_read', {
1294
+ // reduce: true,
1295
+ // group_level: 2,
1296
1296
 
1297
- startkey: [uid, doc._id, ''],
1298
- endkey: [uid, doc._id, 'zzzzzz'],
1299
- });
1297
+ // startkey: [uid, doc._id, ''],
1298
+ // endkey: [uid, doc._id, 'zzzzzz'],
1299
+ // });
1300
1300
 
1301
- return counts_ret?.rows?.[0]?.value || 0;
1302
- };
1301
+ // return counts_ret?.rows?.[0]?.value || 0;
1302
+ // };
1303
1303
 
1304
1304
  doc.notifications = 0;
1305
1305
  if (doc.contact_uid) {
@@ -1376,12 +1376,12 @@ export const get_contact_info = async function (uid, contact_doc, _id) {
1376
1376
  delete doc.person_info;
1377
1377
  delete doc.business_info;
1378
1378
 
1379
- const contact_chat_conversation_count_ret = await chat_conversation_count();
1380
- const contact_chat_conversation_read_ret = await chat_conversation_read();
1379
+ // const contact_chat_conversation_count_ret = await chat_conversation_count();
1380
+ // const contact_chat_conversation_read_ret = await chat_conversation_read();
1381
1381
 
1382
- doc.interactions = contact_chat_conversation_count_ret;
1383
- doc.notifications = contact_chat_conversation_count_ret - contact_chat_conversation_read_ret;
1384
- doc.chats = doc.interactions;
1382
+ // doc.interactions = contact_chat_conversation_count_ret;
1383
+ // doc.notifications = contact_chat_conversation_count_ret - contact_chat_conversation_read_ret;
1384
+ // doc.chats = doc.interactions;
1385
1385
 
1386
1386
  doc.card_background = get_contact_background(doc);
1387
1387
 
@@ -2330,6 +2330,41 @@ export const get_contacts = async function (req, job_id, headers) {
2330
2330
  let shared_from = { docs: [], total_docs: 0 };
2331
2331
 
2332
2332
  let contact_docs = { docs: [], total_docs: contacts.total_docs };
2333
+
2334
+ const chat_conversation_count = async function () {
2335
+ const account_profile_info = await get_active_account_profile_info(uid);
2336
+
2337
+ const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'conversations_item_counts', {
2338
+ reduce: true,
2339
+ group_level: 999,
2340
+
2341
+ startkey: ['contacts', '', ''],
2342
+ endkey: ['contacts', 'zzzzzz', 'zzzzzz'],
2343
+ });
2344
+
2345
+ // return counts_ret?.rows?.[0]?.value || 0;
2346
+
2347
+ let counts = {};
2348
+ for (const val of counts_ret?.rows) {
2349
+ counts[val.key[1]] = val.value;
2350
+ }
2351
+
2352
+ return counts;
2353
+ };
2354
+ const chat_conversation_read = async function () {
2355
+ const account_profile_info = await get_active_account_profile_info(uid);
2356
+
2357
+ const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_read', {
2358
+ reduce: true,
2359
+ group_level: 2,
2360
+
2361
+ startkey: [uid, doc._id, ''],
2362
+ endkey: [uid, doc._id, 'zzzzzz'],
2363
+ });
2364
+
2365
+ return counts_ret?.rows?.[0]?.value || 0;
2366
+ };
2367
+
2333
2368
  for await (let doc of contacts.docs) {
2334
2369
  const ret_to = requests_to.docs.find((e) => {
2335
2370
  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.2132",
3
+ "version": "1.2.2134",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {