@xuda.io/account_module 1.2.2144 → 1.2.2146

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 +35 -31
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1274,32 +1274,36 @@ 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 account_profile_info = await get_active_account_profile_info(uid);
1279
1278
 
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,
1279
+ const chat_conversation_count = async function () {
1280
+ let value = 0;
1283
1281
 
1284
- // startkey: [doc._id, ''],
1285
- // endkey: [doc._id, 'zzzzzz'],
1286
- // });
1282
+ const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_counts', {
1283
+ reduce: true,
1284
+ group_level: 1,
1287
1285
 
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);
1286
+ startkey: [doc._id, ''],
1287
+ endkey: [doc._id, 'zzzzzz'],
1288
+ });
1292
1289
 
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,
1290
+ value = counts_ret?.rows?.[0]?.value || 0;
1296
1291
 
1297
- // startkey: [uid, doc._id, ''],
1298
- // endkey: [uid, doc._id, 'zzzzzz'],
1299
- // });
1292
+ return;
1293
+ };
1294
+ const chat_conversation_read = async function () {
1295
+ // const account_profile_info = await get_active_account_profile_info(uid);
1300
1296
 
1301
- // return counts_ret?.rows?.[0]?.value || 0;
1302
- // };
1297
+ const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_read', {
1298
+ reduce: true,
1299
+ group_level: 2,
1300
+
1301
+ startkey: [uid, doc._id, ''],
1302
+ endkey: [uid, doc._id, 'zzzzzz'],
1303
+ });
1304
+
1305
+ return counts_ret?.rows?.[0]?.value || 0;
1306
+ };
1303
1307
 
1304
1308
  doc.notifications = 0;
1305
1309
  if (doc.contact_uid) {
@@ -1376,12 +1380,12 @@ export const get_contact_info = async function (uid, contact_doc, _id) {
1376
1380
  delete doc.person_info;
1377
1381
  delete doc.business_info;
1378
1382
 
1379
- // const contact_chat_conversation_count_ret = await chat_conversation_count();
1380
- // const contact_chat_conversation_read_ret = await chat_conversation_read();
1383
+ const contact_chat_conversation_count_ret = await chat_conversation_count();
1384
+ const contact_chat_conversation_read_ret = await chat_conversation_read();
1381
1385
 
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;
1386
+ doc.interactions = contact_chat_conversation_count_ret;
1387
+ doc.notifications = contact_chat_conversation_count_ret - contact_chat_conversation_read_ret;
1388
+ doc.chats = doc.interactions;
1385
1389
 
1386
1390
  doc.card_background = get_contact_background(doc);
1387
1391
 
@@ -2376,9 +2380,9 @@ export const get_contacts = async function (req, job_id, headers) {
2376
2380
  return counts;
2377
2381
  };
2378
2382
 
2379
- const contact_chat_conversation_count_ret = await chat_conversation_count();
2380
- const contact_chat_conversation_read_ret = await chat_conversation_read();
2381
- debugger;
2383
+ // const contact_chat_conversation_count_ret = await chat_conversation_count();
2384
+ // const contact_chat_conversation_read_ret = await chat_conversation_read();
2385
+ // debugger;
2382
2386
  for await (let doc of contacts.docs) {
2383
2387
  const ret_to = requests_to.docs.find((e) => {
2384
2388
  return e.contact_uid === doc.contact_uid;
@@ -2392,9 +2396,9 @@ export const get_contacts = async function (req, job_id, headers) {
2392
2396
 
2393
2397
  doc = await get_contact_info(uid, doc);
2394
2398
 
2395
- doc.interactions = contact_chat_conversation_count_ret[doc._id];
2396
- doc.notifications = contact_chat_conversation_count_ret[doc._id] - contact_chat_conversation_read_ret[doc._id];
2397
- doc.chats = doc.interactions;
2399
+ // doc.interactions = contact_chat_conversation_count_ret[doc._id];
2400
+ // doc.notifications = contact_chat_conversation_count_ret[doc._id] - contact_chat_conversation_read_ret[doc._id];
2401
+ // doc.chats = doc.interactions;
2398
2402
 
2399
2403
  if (filter_type === 'online') {
2400
2404
  if (!doc.online) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.2144",
3
+ "version": "1.2.2146",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {