@xuda.io/account_module 1.2.1444 → 1.2.1446

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 +16 -13
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1940,7 +1940,7 @@ setTimeout(async () => {
1940
1940
  // let _design = await db_module.get_app_couch_doc_native(app_id, '_design/xuda');
1941
1941
  // ret = _design.views.ai_chat_usage;
1942
1942
  // console.log(_design.views.ai_chat_usage);
1943
- ret = await set_contact_profile_picture(uid, 'cnt_2d21d55f8f0cdaf65a7a69f696166840', {}, null, {});
1943
+ // ret = await set_contact_profile_picture(uid, 'cnt_2d21d55f8f0cdaf65a7a69f696166840', {}, null, {});
1944
1944
  console.log(ret);
1945
1945
  }, 1000);
1946
1946
 
@@ -2020,17 +2020,9 @@ export const add_contact = async function (req, job_id, headers) {
2020
2020
  // profile_picture = profile_picture_obj.url;
2021
2021
  // }
2022
2022
  }
2023
- if (account_type === 'business' && !is_spam) {
2024
- const business_info = await get_business_info(uid, contact_obj.name, contact_obj.email, account_profile_info);
2025
- const { business_size, business_category, business_sub_category, business_country, business_bio } = business_info;
2026
- contact_obj.mainCategory = business_category;
2027
- contact_obj.subCategory = business_sub_category;
2028
- contact_obj.business_size = business_size;
2029
- contact_obj.country = business_country;
2030
- contact_obj.bio = business_bio;
2031
- }
2023
+
2032
2024
  const d = Date.now();
2033
- const doc = {
2025
+ const contact_obj = {
2034
2026
  _id: await _common.xuda_get_uuid('contact'),
2035
2027
  email,
2036
2028
  name,
@@ -2054,9 +2046,20 @@ export const add_contact = async function (req, job_id, headers) {
2054
2046
  account_profiles: [account_profile_obj._id],
2055
2047
  account_type,
2056
2048
  };
2057
- const save_ret = await save_contact(uid, doc);
2049
+
2050
+ if (account_type === 'business' && !is_spam) {
2051
+ const business_info = await ai_module.get_business_info(uid, contact_obj.name, contact_obj.email, account_profile_info);
2052
+ const { business_size, business_category, business_sub_category, business_country, business_bio } = business_info;
2053
+ contact_obj.mainCategory = business_category;
2054
+ contact_obj.subCategory = business_sub_category;
2055
+ contact_obj.business_size = business_size;
2056
+ contact_obj.country = business_country;
2057
+ contact_obj.bio = business_bio;
2058
+ }
2059
+
2060
+ const save_ret = await save_contact(uid, contact_obj);
2058
2061
  if (!is_spam) {
2059
- await set_contact_profile_picture(uid, doc._id, metadata, job_id, headers);
2062
+ await set_contact_profile_picture(uid, contact_obj._id, metadata, job_id, headers);
2060
2063
  }
2061
2064
  // if (!account_info.profile_avatar) {
2062
2065
  // const ai_module = await import(`${module_path}/ai_module/index.mjs`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1444",
3
+ "version": "1.2.1446",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {