@xuda.io/account_module 1.2.492 → 1.2.494

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 +37 -0
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1257,6 +1257,43 @@ const get_contact_border = function (doc) {
1257
1257
  return ret;
1258
1258
  };
1259
1259
 
1260
+ export const get_contact_info = async function (doc) {
1261
+ if (doc.contact_uid) {
1262
+ const account_info_ret = await get_account_name({ uid_query: doc.contact_uid });
1263
+ if (account_info_ret.code < 0) {
1264
+ return; // throw new Error(`account ${contact_uid} not found`);
1265
+ }
1266
+
1267
+ doc.profile_avatar = account_info_ret.data.profile_avatar;
1268
+
1269
+ doc.card_background = get_contact_background(doc);
1270
+
1271
+ //membership_plan
1272
+ doc.name = `${account_info_ret.data.first_name} ${account_info_ret.data.last_name}`;
1273
+
1274
+ doc.telephone = account_info_ret.data.phone;
1275
+
1276
+ // doc.notifications = 45;
1277
+ // doc.online = true;
1278
+ if (doc.team_req_id) {
1279
+ try {
1280
+ const req_doc = await db_module.get_couch_doc_native('xuda_team', doc.team_req_id);
1281
+ doc.connection_stat = req_doc.team_req_stat;
1282
+ } catch (error) {
1283
+ doc.connection_stat = 0;
1284
+ }
1285
+ }
1286
+
1287
+ doc.icon_pattern = get_contact_pattern(doc);
1288
+ }
1289
+ doc.border = get_contact_border(doc);
1290
+ if (!doc.name) {
1291
+ doc.name = doc.email;
1292
+ }
1293
+
1294
+ doc.email = '';
1295
+ };
1296
+
1260
1297
  export const get_contacts = async function (req) {
1261
1298
  const { _id, uid, name, limit, skip, bookmark, search, with_requests } = req;
1262
1299
  var opt = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.492",
3
+ "version": "1.2.494",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {