@xuda.io/account_module 1.2.408 → 1.2.410

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 +5 -18
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1211,7 +1211,7 @@ export const get_contacts = async function (req) {
1211
1211
  });
1212
1212
 
1213
1213
  for await (let e of requests_to_res.docs) {
1214
- 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 };
1214
+ 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 };
1215
1215
 
1216
1216
  if (e.team_req_to_uid) {
1217
1217
  const account_ret = await get_account_name({ uid_query: e.team_req_to_uid });
@@ -1232,35 +1232,22 @@ export const get_contacts = async function (req) {
1232
1232
  for await (let e of requests_from_res.docs) {
1233
1233
  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 };
1234
1234
 
1235
- if (e.team_req_to_uid) {
1236
- const account_ret = await get_account_name({ uid_query: e.team_req_to_uid });
1235
+ if (e.team_req_from_uid) {
1236
+ const account_ret = await get_account_name({ uid_query: e.team_req_from_uid });
1237
1237
  if (account_ret.code < 0) {
1238
1238
  continue; // throw new Error(`account ${contact_uid} not found`);
1239
1239
  }
1240
1240
  doc.profile_avatar = account_ret.data.profile_avatar;
1241
1241
  doc.name = `${account_ret.data.first_name} ${account_ret.data.last_name}`;
1242
1242
  }
1243
- requests_to.docs.push(doc);
1243
+ requests_from.docs.push(doc);
1244
1244
  }
1245
1245
  }
1246
1246
 
1247
1247
  return {
1248
1248
  code: 1,
1249
1249
  data: {
1250
- docs: [
1251
- ...requests_to.docs,
1252
- ...requests_from.docs.map((e) => ({
1253
- docType: 'contact',
1254
- date_created: e.team_req_date,
1255
- email: [e.sender_account_info.email],
1256
- name: `${e.sender_account_info.first_name} ${e.sender_account_info.last_name}`,
1257
- profile_avatar: e.sender_account_info.profile_avatar || _conf.anonymous_image_url,
1258
- pending: true,
1259
- team_req_from_uid: e.team_req_from_uid,
1260
- team_req_id: e._id,
1261
- })),
1262
- ...contacts.docs,
1263
- ],
1250
+ docs: [...requests_to.docs, ...requests_from, ...contacts.docs],
1264
1251
  },
1265
1252
  };
1266
1253
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.408",
3
+ "version": "1.2.410",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {