@xuda.io/account_module 1.2.1141 → 1.2.1143

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 +11 -7
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2782,19 +2782,23 @@ export const delete_account_profile = async function (req, job_id, headers) {
2782
2782
  export const unarchive_account_profile = async function (req) {
2783
2783
  const { profile_id } = req;
2784
2784
  try {
2785
+ const team_module = await import(`${module_path}/team_module/index.mjs`);
2785
2786
  var account_profile_doc = await db_module.get_couch_doc_native('xuda_accounts', profile_id);
2786
2787
 
2787
2788
  if (account_profile_doc.stat !== 5) {
2788
- throw new Error('contact is not archived');
2789
+ throw new Error('account profile is not archived');
2789
2790
  }
2791
+ if (!account_profile_doc.team_req_id) {
2792
+ account_profile_doc.stat = 3;
2793
+ account_profile_doc.stat_ts = Date.now();
2794
+ account_profile_doc.stat_reason = 'archived by the user';
2790
2795
 
2791
- account_profile_doc.stat = 3;
2792
- account_profile_doc.stat_ts = Date.now();
2793
- account_profile_doc.stat_reason = 'archived by the user';
2794
-
2795
- const account_profile_save_ret = await db_module.save_couch_doc('xuda_accounts', account_profile_doc);
2796
+ const account_profile_save_ret = await db_module.save_couch_doc('xuda_accounts', account_profile_doc);
2796
2797
 
2797
- return account_profile_save_ret;
2798
+ return account_profile_save_ret;
2799
+ } else {
2800
+ return await team_module.change_account_profile_dependencies_status(account_profile_doc.team_req_id, 3);
2801
+ }
2798
2802
  } catch (err) {
2799
2803
  return {
2800
2804
  code: -22,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1141",
3
+ "version": "1.2.1143",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {