@xuda.io/account_module 1.2.2133 → 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.
- package/index.mjs +55 -20
- 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
|
-
|
|
1277
|
+
// const chat_conversation_count = async function () {
|
|
1278
|
+
// const account_profile_info = await get_active_account_profile_info(uid);
|
|
1279
1279
|
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
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
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1284
|
+
// startkey: [doc._id, ''],
|
|
1285
|
+
// endkey: [doc._id, 'zzzzzz'],
|
|
1286
|
+
// });
|
|
1287
1287
|
|
|
1288
|
-
|
|
1289
|
-
};
|
|
1290
|
-
const chat_conversation_read = async function () {
|
|
1291
|
-
|
|
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
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
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
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1297
|
+
// startkey: [uid, doc._id, ''],
|
|
1298
|
+
// endkey: [uid, doc._id, 'zzzzzz'],
|
|
1299
|
+
// });
|
|
1300
1300
|
|
|
1301
|
-
|
|
1302
|
-
};
|
|
1301
|
+
// return counts_ret?.rows?.[0]?.value || 0;
|
|
1302
|
+
// };
|
|
1303
1303
|
|
|
1304
1304
|
doc.notifications = 0;
|
|
1305
1305
|
if (doc.contact_uid) {
|
|
@@ -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;
|