@xuda.io/account_module 1.2.299 → 1.2.300

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 +15 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1166,11 +1166,23 @@ export const get_contacts = async function (req) {
1166
1166
  let requests_to_ret = { docs: [] };
1167
1167
  const anonymous_image_url = 'https://dev.xuda.io/dist/images/graphics/anonymous.svg';
1168
1168
  if (with_requests) {
1169
- requests_from_ret = await db_module.find_couch_query('xuda_team', { selector: { docType: 'team_request', access_type: 'contact', team_req_stat: 2, team_req_from_uid: uid }, fields: ['team_req_date', 'team_req_to_email'] });
1170
- requests_to_ret = await db_module.find_couch_query('xuda_team', { selector: { docType: 'team_request', access_type: 'contact', team_req_stat: 2, team_req_to_uid: uid }, fields: ['team_req_date', 'sender_account_info.email', 'sender_account_info.first_name', 'sender_account_info.last_name'] });
1169
+ requests_from_ret = await db_module.find_couch_query('xuda_team', { selector: { docType: 'team_request', access_type: 'contact', team_req_stat: 2, team_req_from_uid: uid }, fields: ['team_req_date', 'team_req_to_email', 'team_req_from_uid'] });
1170
+ requests_to_ret = await db_module.find_couch_query('xuda_team', {
1171
+ selector: { docType: 'team_request', access_type: 'contact', team_req_stat: 2, team_req_to_uid: uid },
1172
+ fields: ['team_req_date', 'team_req_to_email', 'sender_account_info.email', 'sender_account_info.first_name', 'sender_account_info.last_name'],
1173
+ });
1171
1174
  }
1172
1175
 
1173
- return { code: 1, data: { docs: [...requests_from_ret.docs.map((e) => ({ docType: 'contact', date_created: e.team_req_date, email: [e.team_req_to_email], name: '', profile_avatar: anonymous_image_url })), ...requests_to_ret.docs, ...contacts_ret.docs] } };
1176
+ return {
1177
+ code: 1,
1178
+ data: {
1179
+ docs: [
1180
+ ...requests_from_ret.docs.map((e) => ({ docType: 'contact', date_created: e.team_req_date, email: [e.team_req_to_email], name: '', profile_avatar: anonymous_image_url, pending: true, uid: e.team_req_from_uid })),
1181
+ ...requests_to_ret.docs.map((e) => ({ docType: 'contact', date_created: e.team_req_date, email: [e.sender_account_info.email], name: `${e.sender_account_info.first_name} ${e.sender_account_info.last_name}`, profile_avatar: anonymous_image_url, pending: true, uid: e.team_req_from_uid })),
1182
+ ...contacts_ret.docs,
1183
+ ],
1184
+ },
1185
+ };
1174
1186
  };
1175
1187
 
1176
1188
  export const delete_contact = async function (req) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.299",
3
+ "version": "1.2.300",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {