@xuda.io/account_module 1.2.1380 → 1.2.1382

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 +10 -7
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1980,17 +1980,20 @@ export const add_contact = async function (req, job_id, headers) {
1980
1980
  let profile_picture, profile_picture_obj;
1981
1981
  let profile_avatar, profile_avatar_obj;
1982
1982
  let account_info_ret;
1983
+ let account_info;
1983
1984
  let account_type;
1984
1985
  if (contact_uid) {
1985
- account_info_ret = await get_account_name({ uid_query: contact_uid });
1986
- if (account_info_ret.code < 0) {
1986
+ let { code: account_code, data: account_obj } = await db_module.get_couch_doc('xuda_accounts', contact_uid);
1987
+ account_info = account_obj.account_info;
1988
+ // account_info_ret = await get_account_name({ uid_query: contact_uid });
1989
+ if (account_code < 0) {
1987
1990
  throw new Error(`account ${contact_uid} not found`);
1988
1991
  }
1989
- if (!account_info_ret.data.account_info.profile_picture) {
1990
- profile_picture_obj = await ai_module.get_profile_picture(uid, account_type, name, { email, context, metadata, account_info: account_info_ret.data.account_info }, account_profile_info, job_id, headers);
1992
+ if (!account_obj.account_info.profile_picture) {
1993
+ profile_picture_obj = await ai_module.get_profile_picture(uid, account_type, name, { email, context, metadata, account_info: account_obj.account_info }, account_profile_info, job_id, headers);
1991
1994
  profile_picture = profile_picture_obj.url;
1992
- account_info_ret.data.account_info.profile_picture_obj = profile_picture_obj;
1993
- account_info_ret.data.account_info.profile_picture = profile_picture;
1995
+ account_obj.account_info.profile_picture_obj = profile_picture_obj;
1996
+ account_obj.account_info.profile_picture = profile_picture;
1994
1997
  const account_save_ret = await db_module.save_couch_doc('xuda_accounts', account_obj);
1995
1998
  }
1996
1999
  } else {
@@ -2042,7 +2045,7 @@ export const add_contact = async function (req, job_id, headers) {
2042
2045
  if (!account_info_ret?.data?.profile_avatar) {
2043
2046
  const ai_module = await import(`${module_path}/ai_module/index.mjs`);
2044
2047
  if (account_info_ret?.data?.profile_picture) {
2045
- ai_module.create_profile_avatar({ url: account_info_ret.data.profile_picture, uid, account_obj: { _id: contact_uid, account_info: account_info_ret.data }, account_profile_info }, job_id, headers);
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);
2046
2049
  } else {
2047
2050
  if (!doc.profile_avatar) {
2048
2051
  // create factual avatar
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1380",
3
+ "version": "1.2.1382",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {