@xuda.io/account_module 1.2.402 → 1.2.404
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.
- package/index.mjs +16 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1226,6 +1226,22 @@ export const get_contacts = async function (req) {
|
|
|
1226
1226
|
|
|
1227
1227
|
////// FROM
|
|
1228
1228
|
// requests_from = 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: ['_id', 'team_req_date', 'team_req_to_email', 'team_req_from_uid'] });
|
|
1229
|
+
|
|
1230
|
+
const requests_from_res = 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: ['_id', 'team_req_date', 'team_req_from_email', 'team_req_from_uid'] });
|
|
1231
|
+
|
|
1232
|
+
for await (let e of requests_from_res.docs) {
|
|
1233
|
+
let doc = { docType: 'contact', date_created: e.team_req_date, email: [e.team_req_to_email], name: '', profile_avatar: _conf.anonymous_image_url, pending: true, contact_uid: e.team_req_to_uid, team_req_id: e._id };
|
|
1234
|
+
|
|
1235
|
+
if (e.team_req_to_uid) {
|
|
1236
|
+
const account_ret = await get_account_name({ uid_query: e.team_req_to_uid });
|
|
1237
|
+
if (account_ret.code < 0) {
|
|
1238
|
+
continue; // throw new Error(`account ${contact_uid} not found`);
|
|
1239
|
+
}
|
|
1240
|
+
doc.profile_avatar = account_ret.data.profile_avatar;
|
|
1241
|
+
doc.name = `${account_ret.data.first_name} ${account_ret.data.last_name}`;
|
|
1242
|
+
}
|
|
1243
|
+
requests_to.docs.push(doc);
|
|
1244
|
+
}
|
|
1229
1245
|
}
|
|
1230
1246
|
|
|
1231
1247
|
return {
|