@xuda.io/account_module 1.2.1068 → 1.2.1070
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 +28 -27
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1227,8 +1227,6 @@ const get_contact_background = function (doc) {
|
|
|
1227
1227
|
|
|
1228
1228
|
if (doc.pending) {
|
|
1229
1229
|
ret = `linear-gradient(145deg, #009ec2 0%, #002c74 100%)`;
|
|
1230
|
-
} else if (doc.my_contact) {
|
|
1231
|
-
ret = `linear-gradient(145deg, #242480 0%, #060619 100%)`;
|
|
1232
1230
|
} else {
|
|
1233
1231
|
switch (doc.contact_mood_level) {
|
|
1234
1232
|
case -2: {
|
|
@@ -1553,7 +1551,7 @@ export const get_pending_share_contact_in = async function (uid, _id) {
|
|
|
1553
1551
|
|
|
1554
1552
|
const get_user_contact = async function (uid, uid_query) {
|
|
1555
1553
|
const account_info = (await get_account_name({ uid_query })).data;
|
|
1556
|
-
let doc = { docType: 'contact', account_type: account_info.account_type, date_created: Date.now(), email: account_info.email,
|
|
1554
|
+
let doc = { docType: 'contact', account_type: account_info.account_type, date_created: Date.now(), email: account_info.email, contact_uid: uid_query, username: account_info.username };
|
|
1557
1555
|
|
|
1558
1556
|
doc.name = account_info?.account_type === 'business' ? account_info.business_name : `${account_info.first_name} ${account_info.last_name}`;
|
|
1559
1557
|
doc.profile_avatar = account_info.profile_avatar;
|
|
@@ -2485,6 +2483,30 @@ setTimeout(async () => {
|
|
|
2485
2483
|
console.log(ret);
|
|
2486
2484
|
}, 1000);
|
|
2487
2485
|
|
|
2486
|
+
export const get_pending_share_profile_in = async function (uid, _id) {
|
|
2487
|
+
let docs = [];
|
|
2488
|
+
const from_opt = { selector: { docType: 'team_request', access_type: 'profile', team_req_stat: 2, team_req_to_uid: uid }, fields: ['_id', 'team_req_date', 'sender_account_info.email', 'team_req_from_uid', 'share_item_id'] };
|
|
2489
|
+
|
|
2490
|
+
if (_id) {
|
|
2491
|
+
to_opt.selector._id = _id;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
const requests_from_res = await db_module.find_couch_query('xuda_team', from_opt);
|
|
2495
|
+
|
|
2496
|
+
for await (let e of requests_from_res.docs) {
|
|
2497
|
+
// let doc = { docType: 'contact', date_created: e.team_req_date, email: [e.sender_account_info.email], name: '', pending: true, contact_uid: e.team_req_from_uid, team_req_id: e._id };
|
|
2498
|
+
let doc = await db_module.get_couch_doc_native('xuda_contacts', e.share_item_id);
|
|
2499
|
+
delete doc.contact_mood_level;
|
|
2500
|
+
doc.shared_from_uid = e.team_req_from_uid;
|
|
2501
|
+
doc.pending = true;
|
|
2502
|
+
doc = await get_contact_info(uid, doc);
|
|
2503
|
+
doc.team_req_id = e._id;
|
|
2504
|
+
|
|
2505
|
+
docs.push(doc);
|
|
2506
|
+
}
|
|
2507
|
+
return docs;
|
|
2508
|
+
};
|
|
2509
|
+
|
|
2488
2510
|
export const get_account_profile_info = async function (uid, contact_profile_doc, _id) {
|
|
2489
2511
|
const ai_module = await import(`${module_path}/ai_module/index.mjs`);
|
|
2490
2512
|
let doc = contact_profile_doc;
|
|
@@ -2562,35 +2584,14 @@ export const get_account_profile_info = async function (uid, contact_profile_doc
|
|
|
2562
2584
|
|
|
2563
2585
|
doc.avatar_source = account_info_ret.data.avatar_source;
|
|
2564
2586
|
doc.icon_pattern = await get_pattern(doc);
|
|
2565
|
-
doc.username = account_info_ret.data.username;
|
|
2566
|
-
doc.business_name = account_info_ret.data.business_name;
|
|
2567
|
-
doc.address = account_info_ret.data.address;
|
|
2568
|
-
doc.city = account_info_ret.data.city;
|
|
2569
|
-
doc.state = account_info_ret.data.state;
|
|
2570
|
-
doc.zip = account_info_ret.data.zip;
|
|
2571
|
-
doc.account_type = account_info_ret.data.account_type;
|
|
2572
|
-
doc.email = doc.email?.[0];
|
|
2573
|
-
if (doc.connection_stat === 3) {
|
|
2574
|
-
doc.online = account_info_ret.data.online;
|
|
2575
|
-
}
|
|
2576
2587
|
|
|
2577
2588
|
doc.interactions = 0;
|
|
2578
2589
|
doc.chats = 0;
|
|
2579
2590
|
|
|
2580
2591
|
const chats_ret = await ai_module.get_ai_chats({ uid, reference_id: doc._id });
|
|
2581
|
-
for (let chat_doc of chats_ret.data.docs) {
|
|
2582
|
-
doc.notifications += chat_doc.notifications;
|
|
2583
|
-
|
|
2584
|
-
doc.chats++;
|
|
2585
|
-
if (chat_doc.interactions) {
|
|
2586
|
-
doc.interactions += chat_doc.interactions;
|
|
2587
|
-
}
|
|
2588
|
-
doc.contact_mood_level = chat_doc.mood_level || 0;
|
|
2589
|
-
}
|
|
2590
2592
|
|
|
2591
|
-
doc.card_background =
|
|
2592
|
-
|
|
2593
|
-
doc.border = get_contact_border(doc);
|
|
2593
|
+
doc.card_background = `linear-gradient(145deg, #242480 0%, #060619 100%)`;
|
|
2594
|
+
// doc.border = get_contact_border(doc);
|
|
2594
2595
|
|
|
2595
2596
|
return doc;
|
|
2596
2597
|
};
|
|
@@ -2680,7 +2681,7 @@ export const get_account_profiles = async function (req) {
|
|
|
2680
2681
|
|
|
2681
2682
|
let profile_docs = { docs: [], total_docs: profiles.total_docs };
|
|
2682
2683
|
for await (let doc of profiles.docs) {
|
|
2683
|
-
doc = await
|
|
2684
|
+
doc = await get_account_profile_info(uid, doc);
|
|
2684
2685
|
|
|
2685
2686
|
profile_docs.docs.push(doc);
|
|
2686
2687
|
}
|