@xuda.io/account_module 1.2.2245 → 1.2.2247

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 +12 -0
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -3098,6 +3098,7 @@ export const archive_account_profile = async function (req) {
3098
3098
  const { uid, profile_id } = req;
3099
3099
  try {
3100
3100
  const app_id = await get_account_default_project_id(uid);
3101
+ const account_doc = await db_module.get_couch_doc_native('xuda_accounts', uid);
3101
3102
 
3102
3103
  // await team_ms.validate_share_exist(uid, 'account_profile', profile_id);
3103
3104
 
@@ -3113,6 +3114,11 @@ export const archive_account_profile = async function (req) {
3113
3114
 
3114
3115
  const account_profile_save_ret = await db_module.save_app_couch_doc(app_id, account_profile_doc);
3115
3116
 
3117
+ if (account_doc?.account_info?.active_account_profile_id === profile_id) {
3118
+ account_doc.account_info.active_account_profile_id = account_doc.account_profile_id;
3119
+ await db_module.save_couch_doc('xuda_accounts', account_doc);
3120
+ }
3121
+
3116
3122
  return account_profile_save_ret;
3117
3123
  } catch (err) {
3118
3124
  return {
@@ -3126,6 +3132,7 @@ export const delete_account_profile = async function (req, job_id, headers) {
3126
3132
  const { profile_id, uid } = req;
3127
3133
  try {
3128
3134
  const app_id = await get_account_default_project_id(uid);
3135
+ const account_doc = await db_module.get_couch_doc_native('xuda_accounts', uid);
3129
3136
 
3130
3137
  await team_ms.validate_share_exist(uid, 'account_profile', profile_id);
3131
3138
 
@@ -3139,6 +3146,11 @@ export const delete_account_profile = async function (req, job_id, headers) {
3139
3146
 
3140
3147
  const account_profile_save_ret = await db_module.save_app_couch_doc(app_id, account_profile_doc);
3141
3148
 
3149
+ if (account_doc?.account_info?.active_account_profile_id === profile_id) {
3150
+ account_doc.account_info.active_account_profile_id = account_doc.account_profile_id;
3151
+ await db_module.save_couch_doc('xuda_accounts', account_doc);
3152
+ }
3153
+
3142
3154
  ai_msa.delete_depended_chats(uid, profile_id);
3143
3155
  return account_profile_save_ret;
3144
3156
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.2245",
3
+ "version": "1.2.2247",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {