@xuda.io/account_module 1.2.376 → 1.2.378
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 +9 -10
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1139,7 +1139,6 @@ export const merge_contact = async function (req) {
|
|
|
1139
1139
|
};
|
|
1140
1140
|
|
|
1141
1141
|
export const get_contacts = async function (req) {
|
|
1142
|
-
debugger;
|
|
1143
1142
|
const { uid, name, limit, skip, bookmark, search, with_requests } = req;
|
|
1144
1143
|
var opt = {
|
|
1145
1144
|
selector: {
|
|
@@ -1189,9 +1188,9 @@ export const get_contacts = async function (req) {
|
|
|
1189
1188
|
opt.bookmark = bookmark;
|
|
1190
1189
|
}
|
|
1191
1190
|
|
|
1192
|
-
const
|
|
1191
|
+
const contacts = await db_module.find_couch_query('xuda_contacts', opt);
|
|
1193
1192
|
debugger;
|
|
1194
|
-
for await (let doc of
|
|
1193
|
+
for await (let doc of contacts.docs) {
|
|
1195
1194
|
if (doc.contact_uid) {
|
|
1196
1195
|
const account_ret = await get_account_name({ uid_query: doc.contact_uid });
|
|
1197
1196
|
if (account_ret.code < 0) {
|
|
@@ -1201,12 +1200,12 @@ export const get_contacts = async function (req) {
|
|
|
1201
1200
|
}
|
|
1202
1201
|
}
|
|
1203
1202
|
|
|
1204
|
-
let
|
|
1205
|
-
let
|
|
1203
|
+
let requests_from = { docs: [] };
|
|
1204
|
+
let requests_to = { docs: [] };
|
|
1206
1205
|
|
|
1207
1206
|
if (with_requests) {
|
|
1208
|
-
|
|
1209
|
-
|
|
1207
|
+
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'] });
|
|
1208
|
+
requests_to = await db_module.find_couch_query('xuda_team', {
|
|
1210
1209
|
selector: { docType: 'team_request', access_type: 'contact', team_req_stat: 2, team_req_to_uid: uid },
|
|
1211
1210
|
fields: ['_id', 'team_req_date', 'team_req_to_email', 'sender_account_info.email', 'sender_account_info.first_name', 'sender_account_info.last_name', 'sender_account_info.profile_avatar', 'team_req_from_uid'],
|
|
1212
1211
|
});
|
|
@@ -1216,8 +1215,8 @@ export const get_contacts = async function (req) {
|
|
|
1216
1215
|
code: 1,
|
|
1217
1216
|
data: {
|
|
1218
1217
|
docs: [
|
|
1219
|
-
...
|
|
1220
|
-
...
|
|
1218
|
+
...requests_from.docs.map((e) => ({ docType: 'contact', date_created: e.team_req_date, email: [e.team_req_to_email], name: '', profile_avatar: _conf.anonymous_image_url, pending: true, uid: e.team_req_from_uid, team_req_id: e._id })),
|
|
1219
|
+
...requests_to.docs.map((e) => ({
|
|
1221
1220
|
docType: 'contact',
|
|
1222
1221
|
date_created: e.team_req_date,
|
|
1223
1222
|
email: [e.sender_account_info.email],
|
|
@@ -1227,7 +1226,7 @@ export const get_contacts = async function (req) {
|
|
|
1227
1226
|
team_req_from_uid: e.team_req_from_uid,
|
|
1228
1227
|
team_req_id: e._id,
|
|
1229
1228
|
})),
|
|
1230
|
-
...
|
|
1229
|
+
...contacts.docs,
|
|
1231
1230
|
],
|
|
1232
1231
|
},
|
|
1233
1232
|
};
|