@xuda.io/account_module 1.2.1385 → 1.2.1387

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 +24 -4
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -195,7 +195,7 @@ export const update_account_info = async function (req, job_id, headers) {
195
195
  const ai_module = await import(`${module_path}/ai_module/index.mjs`);
196
196
  if (account_obj.account_info?.profile_picture) {
197
197
  if (!account_obj.account_info?.profile_avatar) {
198
- ai_module.create_profile_avatar({ url: account_obj.account_info?.profile_picture, uid, account_obj, account_profile_info }, job_id, headers);
198
+ ai_module.get_profile_avatar({ url: account_obj.account_info?.profile_picture, uid, account_obj, account_profile_info }, job_id, headers);
199
199
  }
200
200
  } else {
201
201
  ai_module.update_thumbnail('account', account_obj, account_obj.account_project_id, uid, job_id, headers, 'xuda_accounts');
@@ -1771,7 +1771,7 @@ export const get_user_card = async function (uid, uid_query) {
1771
1771
  // try {
1772
1772
  // const ai_module = await import(`${module_path}/ai_module/index.mjs`);
1773
1773
 
1774
- // ai_module.create_profile_avatar({ url: account_info?.profile_picture, uid, account_obj }, job_id, headers);
1774
+ // ai_module.get_profile_avatar({ url: account_info?.profile_picture, uid, account_obj }, job_id, headers);
1775
1775
 
1776
1776
  // // const account_info = await get_account_name({ uid });
1777
1777
  // // let username = 'unknown';
@@ -1991,11 +1991,13 @@ export const add_contact = async function (req, job_id, headers) {
1991
1991
  }
1992
1992
  if (!account_info.profile_picture) {
1993
1993
  account_info.profile_picture_obj = await ai_module.get_profile_picture(uid, account_type, name, { email, context, metadata, account_info }, account_profile_info, job_id, headers);
1994
- account_info.profile_picture = account_info.profile_picture_obj.url;
1994
+ account_info.profile_picture = account_info.profile_picture_obj.file_url;
1995
1995
  // account_info.profile_picture_obj = profile_picture_obj;
1996
1996
  // account_info.profile_picture = profile_picture;
1997
1997
  const account_save_ret = await db_module.save_couch_doc('xuda_accounts', account_obj);
1998
1998
  }
1999
+
2000
+ const { bio, business_name, country, mainCategory, subCategory } = account_info;
1999
2001
  } else {
2000
2002
  // contact without use account
2001
2003
 
@@ -2035,6 +2037,8 @@ export const add_contact = async function (req, job_id, headers) {
2035
2037
  team_req_id,
2036
2038
  metadata,
2037
2039
  is_spam,
2040
+ profile_picture,
2041
+ profile_picture_obj,
2038
2042
  profile_avatar,
2039
2043
  profile_avatar_obj,
2040
2044
  account_profiles: [account_profile_obj._id],
@@ -2045,7 +2049,7 @@ export const add_contact = async function (req, job_id, headers) {
2045
2049
  if (!account_info.profile_avatar) {
2046
2050
  const ai_module = await import(`${module_path}/ai_module/index.mjs`);
2047
2051
  if (account_info_ret?.data?.profile_picture) {
2048
- ai_module.create_profile_avatar({ url: account_obj.profile_picture, uid, account_obj: { _id: contact_uid, account_info: account_info_ret.data }, account_profile_info }, job_id, headers);
2052
+ ai_module.get_profile_avatar({ url: account_obj.profile_picture, uid, account_obj: { _id: contact_uid, account_info: account_info_ret.data }, account_profile_info }, job_id, headers);
2049
2053
  } else {
2050
2054
  if (!doc.profile_avatar) {
2051
2055
  // create factual avatar
@@ -2061,6 +2065,22 @@ export const add_contact = async function (req, job_id, headers) {
2061
2065
  }
2062
2066
  };
2063
2067
 
2068
+ const set_account_profile_picture = async function (uid, contact_uid) {
2069
+ let { code: account_code, data: account_obj } = await db_module.get_couch_doc('xuda_accounts', contact_uid);
2070
+ let account_info = account_obj.account_info;
2071
+ // account_info_ret = await get_account_name({ uid_query: contact_uid });
2072
+ if (account_code < 0) {
2073
+ throw new Error(`account ${contact_uid} not found`);
2074
+ }
2075
+ if (!account_info.profile_picture) {
2076
+ account_info.profile_picture_obj = await ai_module.get_profile_picture(uid, account_type, name, { email, context, metadata, account_info }, account_profile_info, job_id, headers);
2077
+ account_info.profile_picture = account_info.profile_picture_obj.file_url;
2078
+ // account_info.profile_picture_obj = profile_picture_obj;
2079
+ // account_info.profile_picture = profile_picture;
2080
+ const account_save_ret = await db_module.save_couch_doc('xuda_accounts', account_obj);
2081
+ }
2082
+ };
2083
+
2064
2084
  export const get_contacts = async function (req) {
2065
2085
  const { _id, uid, name, limit, skip, bookmark, search, filter_type = 'all', contact_id, profile_id } = req;
2066
2086
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1385",
3
+ "version": "1.2.1387",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {