@xuda.io/account_module 1.2.1331 → 1.2.1333

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 +26 -22
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2776,48 +2776,52 @@ 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 } = 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) {
2784
2787
  case 'ai_chat': {
2785
2788
  break;
2786
2789
  }
2787
2790
 
2788
2791
  default:
2792
+ throw new Error('entity not supported');
2789
2793
  break;
2790
2794
  }
2791
2795
 
2792
- let { data: account_profile_doc } = await db_module.get_app_couch_doc(app_id, _id);
2796
+ // let { data: account_profile_doc } = await db_module.get_app_couch_doc(app_id, _id);
2793
2797
 
2794
- if (account_profile_doc.docType !== 'account_profile') {
2795
- throw new Error('not account profile doc');
2796
- }
2798
+ // if (account_profile_doc.docType !== 'account_profile') {
2799
+ // throw new Error('not account profile doc');
2800
+ // }
2797
2801
 
2798
- let changes_arr = [];
2802
+ // let changes_arr = [];
2799
2803
 
2800
- for (const key of account_profile_properties) {
2801
- let val = req[key];
2802
- if (typeof val === 'undefined') continue;
2803
- if (account_profile_doc[key] !== val) {
2804
- changes_arr.push(key);
2805
- account_profile_doc[key] = val;
2806
- }
2807
- }
2804
+ // for (const key of account_profile_properties) {
2805
+ // let val = req[key];
2806
+ // if (typeof val === 'undefined') continue;
2807
+ // if (account_profile_doc[key] !== val) {
2808
+ // changes_arr.push(key);
2809
+ // account_profile_doc[key] = val;
2810
+ // }
2811
+ // }
2808
2812
 
2809
- if (!changes_arr.length) {
2810
- // throw new Error('no change');
2811
- return { code: 56, data: 'no change' };
2812
- }
2813
+ // if (!changes_arr.length) {
2814
+ // // throw new Error('no change');
2815
+ // return { code: 56, data: 'no change' };
2816
+ // }
2813
2817
 
2814
- account_profile_doc.ts = Date.now();
2818
+ // account_profile_doc.ts = Date.now();
2815
2819
 
2816
2820
  const save_ret = await db_module.save_app_couch_doc(app_id, account_profile_doc);
2817
2821
 
2818
- return { code: 56, data: save_ret };
2822
+ return { code: 57, data: save_ret };
2819
2823
  } catch (err) {
2820
- return { code: -56, data: err.message };
2824
+ return { code: -57, data: err.message };
2821
2825
  }
2822
2826
  };
2823
2827
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1331",
3
+ "version": "1.2.1333",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {