@xuda.io/account_module 1.2.1332 → 1.2.1334
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 +27 -22
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2776,12 +2776,17 @@ export const update_account_profile = async function (req, job_id, headers) {
|
|
|
2776
2776
|
};
|
|
2777
2777
|
|
|
2778
2778
|
export const update_entity_account_profiles = async function (req, job_id, headers) {
|
|
2779
|
-
const { uid, entity } = req;
|
|
2780
|
-
const app_id = await get_account_default_project_id(uid);
|
|
2779
|
+
const { uid, entity, _id, account_profiles } = req;
|
|
2780
|
+
const app_id = await account_module.get_account_default_project_id(uid);
|
|
2781
2781
|
|
|
2782
|
+
let save_ret;
|
|
2782
2783
|
try {
|
|
2784
|
+
let doc = await db_module.get_app_couch_doc_native(app_id, _id);
|
|
2785
|
+
|
|
2783
2786
|
switch (entity) {
|
|
2787
|
+
case 'ai_chat':
|
|
2784
2788
|
case 'ai_chat': {
|
|
2789
|
+
doc.account_profiles = account_profiles;
|
|
2785
2790
|
break;
|
|
2786
2791
|
}
|
|
2787
2792
|
|
|
@@ -2790,35 +2795,35 @@ export const update_entity_account_profiles = async function (req, job_id, heade
|
|
|
2790
2795
|
break;
|
|
2791
2796
|
}
|
|
2792
2797
|
|
|
2793
|
-
let { data: account_profile_doc } = await db_module.get_app_couch_doc(app_id, _id);
|
|
2798
|
+
// let { data: account_profile_doc } = await db_module.get_app_couch_doc(app_id, _id);
|
|
2794
2799
|
|
|
2795
|
-
if (account_profile_doc.docType !== 'account_profile') {
|
|
2796
|
-
|
|
2797
|
-
}
|
|
2800
|
+
// if (account_profile_doc.docType !== 'account_profile') {
|
|
2801
|
+
// throw new Error('not account profile doc');
|
|
2802
|
+
// }
|
|
2798
2803
|
|
|
2799
|
-
let changes_arr = [];
|
|
2804
|
+
// let changes_arr = [];
|
|
2800
2805
|
|
|
2801
|
-
for (const key of account_profile_properties) {
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
}
|
|
2806
|
+
// for (const key of account_profile_properties) {
|
|
2807
|
+
// let val = req[key];
|
|
2808
|
+
// if (typeof val === 'undefined') continue;
|
|
2809
|
+
// if (account_profile_doc[key] !== val) {
|
|
2810
|
+
// changes_arr.push(key);
|
|
2811
|
+
// account_profile_doc[key] = val;
|
|
2812
|
+
// }
|
|
2813
|
+
// }
|
|
2809
2814
|
|
|
2810
|
-
if (!changes_arr.length) {
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
}
|
|
2815
|
+
// if (!changes_arr.length) {
|
|
2816
|
+
// // throw new Error('no change');
|
|
2817
|
+
// return { code: 56, data: 'no change' };
|
|
2818
|
+
// }
|
|
2814
2819
|
|
|
2815
|
-
account_profile_doc.ts = Date.now();
|
|
2820
|
+
// account_profile_doc.ts = Date.now();
|
|
2816
2821
|
|
|
2817
2822
|
const save_ret = await db_module.save_app_couch_doc(app_id, account_profile_doc);
|
|
2818
2823
|
|
|
2819
|
-
return { code:
|
|
2824
|
+
return { code: 57, data: save_ret };
|
|
2820
2825
|
} catch (err) {
|
|
2821
|
-
return { code: -
|
|
2826
|
+
return { code: -57, data: err.message };
|
|
2822
2827
|
}
|
|
2823
2828
|
};
|
|
2824
2829
|
|