@xuda.io/ai_module 1.1.4423 → 1.1.4425
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 +0 -64
- package/old.mjs +45 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4368,70 +4368,6 @@ const update_conversation_mood_level = async function (uid, target_contacts = []
|
|
|
4368
4368
|
await account_module.save_contact(target.uid, contact_doc);
|
|
4369
4369
|
}
|
|
4370
4370
|
}
|
|
4371
|
-
|
|
4372
|
-
// //////// Sender
|
|
4373
|
-
// if (sender_uid) {
|
|
4374
|
-
// const sender_app_id = await account_module.get_account_default_project_id(sender_uid);
|
|
4375
|
-
|
|
4376
|
-
// let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
|
|
4377
|
-
// sender_conversation_doc.mood_level = mood_level_obj.mood_level;
|
|
4378
|
-
// await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
|
|
4379
|
-
|
|
4380
|
-
// if (update_contact) {
|
|
4381
|
-
// // const sender_contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_contact_uid', { key: [receiver_uid, sender_uid] });
|
|
4382
|
-
|
|
4383
|
-
// const opt = {
|
|
4384
|
-
// selector: {
|
|
4385
|
-
// docType: 'contact',
|
|
4386
|
-
// stat: 3,
|
|
4387
|
-
// contact_uid: sender_uid,
|
|
4388
|
-
// },
|
|
4389
|
-
// limit: 1,
|
|
4390
|
-
// fields: ['_id'],
|
|
4391
|
-
// };
|
|
4392
|
-
// const sender_contact_ret = await account_module.find_contact_query(receiver_uid, opt);
|
|
4393
|
-
|
|
4394
|
-
// if (!sender_contact_ret?.docs?.length) {
|
|
4395
|
-
// throw new Error('sender contact id not found');
|
|
4396
|
-
// }
|
|
4397
|
-
// const sender_contact_id = sender_contact_ret?.docs[0]._id;
|
|
4398
|
-
// let sender_contact_doc = await account_module.get_contact(sender_uid, sender_contact_id);
|
|
4399
|
-
// sender_contact_doc.contact_mood_level = mood_level_obj.mood_level;
|
|
4400
|
-
// sender_contact_doc.ts = Date.now();
|
|
4401
|
-
// await account_module.save_contact(sender_uid, sender_contact_doc);
|
|
4402
|
-
// }
|
|
4403
|
-
// }
|
|
4404
|
-
// //////// Receiver
|
|
4405
|
-
|
|
4406
|
-
// const receiver_app_id = await account_module.get_account_default_project_id(receiver_uid);
|
|
4407
|
-
|
|
4408
|
-
// let receiver_conversation_doc = await db_module.get_app_couch_doc_native(receiver_app_id, conversation_id);
|
|
4409
|
-
// receiver_conversation_doc.mood_level = mood_level_obj.mood_level;
|
|
4410
|
-
// await db_module.save_app_couch_doc_native(receiver_app_id, receiver_conversation_doc);
|
|
4411
|
-
|
|
4412
|
-
// if (update_contact) {
|
|
4413
|
-
// // const receiver_contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_contact_uid', { key: [sender_uid, receiver_uid] });
|
|
4414
|
-
|
|
4415
|
-
// const opt = {
|
|
4416
|
-
// selector: {
|
|
4417
|
-
// docType: 'contact',
|
|
4418
|
-
// stat: 3,
|
|
4419
|
-
// contact_uid: receiver_uid,
|
|
4420
|
-
// },
|
|
4421
|
-
// limit: 1,
|
|
4422
|
-
// fields: ['_id'],
|
|
4423
|
-
// };
|
|
4424
|
-
// const receiver_contact_ret = await account_module.find_contact_query(sender_uid, opt);
|
|
4425
|
-
|
|
4426
|
-
// if (!receiver_contact_ret?.docs?.length) {
|
|
4427
|
-
// throw new Error('receiver contact id not found');
|
|
4428
|
-
// }
|
|
4429
|
-
// const receiver_contact_id = receiver_contact_ret?.docs[0]._id;
|
|
4430
|
-
// let receiver_contact_doc = await account_module.get_contact(receiver_uid, receiver_contact_id);
|
|
4431
|
-
// receiver_contact_doc.contact_mood_level = mood_level_obj.mood_level;
|
|
4432
|
-
// receiver_contact_doc.ts = Date.now();
|
|
4433
|
-
// await account_module.save_contact(receiver_uid, receiver_contact_doc);
|
|
4434
|
-
// }
|
|
4435
4371
|
} catch (err) {
|
|
4436
4372
|
debugger;
|
|
4437
4373
|
}
|
package/old.mjs
CHANGED
|
@@ -2041,3 +2041,48 @@ for await (let account_profile of profile_requests_from_res.docs) {
|
|
|
2041
2041
|
// };
|
|
2042
2042
|
|
|
2043
2043
|
// The one-liner wrapper
|
|
2044
|
+
|
|
2045
|
+
// TBD
|
|
2046
|
+
// export const update_contacts_with_account_changes = async function (uid, changes = []) {
|
|
2047
|
+
// try {
|
|
2048
|
+
// if (!changes.length) return;
|
|
2049
|
+
// const ret = await db_module.get_couch_doc('xuda_accounts', uid);
|
|
2050
|
+
// var account_obj = ret.data;
|
|
2051
|
+
// account_obj.ts = Date.now();
|
|
2052
|
+
|
|
2053
|
+
// // update all uid contacts with the new avatar
|
|
2054
|
+
// const opt = {
|
|
2055
|
+
// selector: { contact_uid: uid, docType: 'contact' },
|
|
2056
|
+
// };
|
|
2057
|
+
// debugger;
|
|
2058
|
+
// let changes_made;
|
|
2059
|
+
// var contacts = await db_module.find_couch_query('xuda_contacts', opt);
|
|
2060
|
+
// for (let doc of contacts.docs) {
|
|
2061
|
+
// if (changes.includes('profile_picture')) {
|
|
2062
|
+
// changes_made = true;
|
|
2063
|
+
// doc.profile_picture = account_obj.account_info.profile_picture;
|
|
2064
|
+
// }
|
|
2065
|
+
// if (changes.includes('profile_avatar')) {
|
|
2066
|
+
// changes_made = true;
|
|
2067
|
+
// doc.profile_avatar = account_obj.account_info.profile_avatar;
|
|
2068
|
+
// }
|
|
2069
|
+
// if (changes.includes('email')) {
|
|
2070
|
+
// changes_made = true;
|
|
2071
|
+
// doc.email = account_obj.account_info.email;
|
|
2072
|
+
// }
|
|
2073
|
+
// if (changes.includes('first_name') || changes.includes('last_name')) {
|
|
2074
|
+
// changes_made = true;
|
|
2075
|
+
// doc.name = `${account_obj.account_info.first_name} ${account_obj.account_info.last_name}`;
|
|
2076
|
+
// }
|
|
2077
|
+
|
|
2078
|
+
// console.log(doc);
|
|
2079
|
+
// }
|
|
2080
|
+
// if (contacts.docs && changes_made) {
|
|
2081
|
+
// await db_module.save_couch_bulk_docs('xuda_contacts', contacts.docs);
|
|
2082
|
+
// }
|
|
2083
|
+
|
|
2084
|
+
// return username;
|
|
2085
|
+
// } catch (err) {
|
|
2086
|
+
// return 'unknown';
|
|
2087
|
+
// }
|
|
2088
|
+
// };
|