@xuda.io/account_module 1.2.475 → 1.2.476

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 +17 -16
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1277,12 +1277,12 @@ export const get_contacts = async function (req) {
1277
1277
 
1278
1278
  for await (let doc of contacts.docs) {
1279
1279
  if (doc.contact_uid) {
1280
- const account_ret = await get_account_name({ uid_query: doc.contact_uid });
1281
- if (account_ret.code < 0) {
1280
+ const account_info_ret = await get_account_name({ uid_query: doc.contact_uid });
1281
+ if (account_info_ret.code < 0) {
1282
1282
  continue; // throw new Error(`account ${contact_uid} not found`);
1283
1283
  }
1284
1284
 
1285
- doc.profile_avatar = account_ret.data.profile_avatar;
1285
+ doc.profile_avatar = account_info_ret.data.profile_avatar;
1286
1286
 
1287
1287
  doc.card_background = get_contact_background(doc);
1288
1288
 
@@ -1308,12 +1308,12 @@ export const get_contacts = async function (req) {
1308
1308
  let doc = { docType: 'contact', date_created: e.team_req_date, email: [e.team_req_to_email], name: '', pending: true, contact_uid: e.team_req_to_uid, team_req_id: e._id, team_req_from_uid: uid };
1309
1309
 
1310
1310
  if (e.team_req_to_uid) {
1311
- const account_ret = await get_account_name({ uid_query: e.team_req_to_uid });
1312
- if (account_ret.code < 0) {
1311
+ const account_info_ret = await get_account_name({ uid_query: e.team_req_to_uid });
1312
+ if (account_info_ret.code < 0) {
1313
1313
  continue; // throw new Error(`account ${contact_uid} not found`);
1314
1314
  }
1315
- doc.profile_avatar = account_ret.data.profile_avatar;
1316
- doc.name = `${account_ret.data.first_name} ${account_ret.data.last_name}`;
1315
+ doc.profile_avatar = account_info_ret.data.profile_avatar;
1316
+ doc.name = `${account_info_ret.data.first_name} ${account_info_ret.data.last_name}`;
1317
1317
  }
1318
1318
  doc.icon_pattern = get_contact_pattern(doc);
1319
1319
  doc.card_background = get_contact_background({ pending: true });
@@ -1327,12 +1327,12 @@ export const get_contacts = async function (req) {
1327
1327
  let doc = { docType: 'contact', date_created: e.team_req_date, email: [e.sender_account_info.email], name: '', pending: true, contact_uid: e.team_req_from_uid, team_req_id: e._id };
1328
1328
 
1329
1329
  if (e.team_req_from_uid) {
1330
- const account_ret = await get_account_name({ uid_query: e.team_req_from_uid });
1331
- if (account_ret.code < 0) {
1330
+ const account_info_ret = await get_account_name({ uid_query: e.team_req_from_uid });
1331
+ if (account_info_ret.code < 0) {
1332
1332
  continue; // throw new Error(`account ${contact_uid} not found`);
1333
1333
  }
1334
- doc.profile_avatar = account_ret.data.profile_avatar;
1335
- doc.name = `${account_ret.data.first_name} ${account_ret.data.last_name}`;
1334
+ doc.profile_avatar = account_info_ret.data.profile_avatar;
1335
+ doc.name = `${account_info_ret.data.first_name} ${account_info_ret.data.last_name}`;
1336
1336
  }
1337
1337
  doc.card_background = get_contact_background({ pending: true });
1338
1338
  doc.icon_pattern = get_contact_pattern(doc);
@@ -1385,10 +1385,10 @@ export const add_contact = async function (req, job_id, headers) {
1385
1385
  if (contact_ret.rows.length) {
1386
1386
  throw new Error('contact already exist active or deleted');
1387
1387
  }
1388
- let account_ret;
1388
+ let account_info_ret;
1389
1389
  if (contact_uid) {
1390
- account_ret = await get_account_name({ uid_query: contact_uid });
1391
- if (account_ret.code < 0) {
1390
+ account_info_ret = await get_account_name({ uid_query: contact_uid });
1391
+ if (account_info_ret.code < 0) {
1392
1392
  throw new Error(`account ${contact_uid} not found`);
1393
1393
  }
1394
1394
  }
@@ -1411,10 +1411,11 @@ export const add_contact = async function (req, job_id, headers) {
1411
1411
  };
1412
1412
  const ret = await db_module.save_couch_doc('xuda_contacts', doc);
1413
1413
 
1414
- if (!account_ret?.data?.profile_avatar) {
1414
+ if (!account_info_ret?.data?.profile_avatar) {
1415
1415
  const app_id = await get_account_default_project_id(uid);
1416
1416
  const ai_module = await import(`${module_path}/ai_module/index.mjs`);
1417
- if (account_ret?.data?.profile_avatar) {
1417
+ if (account_info_ret?.data?.profile_avatar) {
1418
+ ai_module.convert_profile_image_to_avatar({ url: account_obj.account_info?.profile_picture, uid, account_obj }, job_id, headers);
1418
1419
  } else {
1419
1420
  // create factual avatar
1420
1421
  ai_module.update_thumbnail('contact', doc, app_id, uid, job_id, headers, 'xuda_contacts', [email, doc._id, 'contact', app_id]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.475",
3
+ "version": "1.2.476",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {