@xuda.io/account_module 1.2.414 → 1.2.416

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 -6
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -30,6 +30,12 @@ export const update_account_info = async function (req, job_id, headers) {
30
30
  const { uid } = req;
31
31
  const data = req;
32
32
 
33
+ delete data.gtp_token;
34
+ delete data.uid;
35
+ delete data.token_ret;
36
+ delete data.job_id;
37
+ delete data.profile_avatar;
38
+
33
39
  function validate_input(string, max_length, is_mandatory, is_pass) {
34
40
  if (!/^[a-zA-Z0-9,.@ ]*$/.test(string) && !is_pass) {
35
41
  // if (!preg_match('^[a-zA-Z0-9,.@ ]*$', string) && !is_pass) {
@@ -59,10 +65,6 @@ export const update_account_info = async function (req, job_id, headers) {
59
65
  account_info_changes_arr.push(key);
60
66
  account_obj.account_info[key] = val;
61
67
 
62
- if (key === 'profile_picture') {
63
- account_obj.account_info['profile_avatar'] = '';
64
- }
65
-
66
68
  if (account_obj.account_info.account_type === 'business') {
67
69
  if (key === 'company_name' && validate_input(val, 150, true, false) < 0) {
68
70
  error[key] = 'Invalid company';
@@ -109,6 +111,10 @@ export const update_account_info = async function (req, job_id, headers) {
109
111
  return { code: 1300, data: 'no change' };
110
112
  }
111
113
 
114
+ if (account_info_changes_arr.includes('profile_picture')) {
115
+ account_obj.account_info['profile_avatar'] = '';
116
+ }
117
+
112
118
  //clean up received from req
113
119
  delete account_obj.account_info.gtp_token;
114
120
  delete account_obj.account_info.client_id;
@@ -130,7 +136,7 @@ export const update_account_info = async function (req, job_id, headers) {
130
136
  await drive_module.create_drive_folder_user({ ...drive_req, ...{ folder_name: 'Chat Attachments', is_system: true } }, job_id, headers);
131
137
  }
132
138
  }
133
- debugger;
139
+
134
140
  const ai_module = await import(`${module_path}/ai_module/index.mjs`);
135
141
  if (account_obj.account_info?.profile_picture) {
136
142
  if (!account_obj.account_info?.profile_avatar) {
@@ -1311,7 +1317,6 @@ export const archive_contact = async function (req) {
1311
1317
 
1312
1318
  export const add_contact = async function (req, job_id, headers) {
1313
1319
  try {
1314
- debugger;
1315
1320
  const { uid, email, name, stat, contact_uid, context, source, team_req_id } = req;
1316
1321
  const contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_email_address', { key: [uid, email] });
1317
1322
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.414",
3
+ "version": "1.2.416",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {