@xuda.io/account_module 1.2.30 → 1.2.32
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.js +67 -67
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -705,12 +705,12 @@ exports.validate_user_plan = async function (req) {
|
|
|
705
705
|
// }
|
|
706
706
|
// }
|
|
707
707
|
|
|
708
|
-
if (app_obj.app_type === "backup" && ret.data.plan === "free") {
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
}
|
|
708
|
+
// if (app_obj.app_type === "backup" && ret.data.plan === "free") {
|
|
709
|
+
// return {
|
|
710
|
+
// code: -10,
|
|
711
|
+
// data: `The free plan does not include the ability to perform backups. To access backup capabilities, please consider upgrading your plan. You can do so by visiting https://xuda.io/dashboard/settings/billing.`,
|
|
712
|
+
// };
|
|
713
|
+
// }
|
|
714
714
|
|
|
715
715
|
return { code: 1, data: ret.data };
|
|
716
716
|
};
|
|
@@ -1127,67 +1127,6 @@ const generate_gmail_access_token = async function (email_account) {
|
|
|
1127
1127
|
});
|
|
1128
1128
|
};
|
|
1129
1129
|
|
|
1130
|
-
setTimeout(async () => {
|
|
1131
|
-
const uid = "0489f946c213947316647b468f029ed9"; //"aecc740881fd0a35098c738652000fab";
|
|
1132
|
-
|
|
1133
|
-
// // clear data
|
|
1134
|
-
// const contact_ret = await db_module.find_couch_query("xuda_contacts", {
|
|
1135
|
-
// selector: {
|
|
1136
|
-
// docType: "contact",
|
|
1137
|
-
// },
|
|
1138
|
-
// limit: 99999,
|
|
1139
|
-
// });
|
|
1140
|
-
// var contact_docs = [];
|
|
1141
|
-
// for (let val of contact_ret.docs) {
|
|
1142
|
-
// val._deleted = true;
|
|
1143
|
-
// contact_docs.push(val);
|
|
1144
|
-
// }
|
|
1145
|
-
// await db_module.sava_couch_bulk_docs("xuda_contacts", contact_docs);
|
|
1146
|
-
|
|
1147
|
-
// const emails_ret = await db_module.find_couch_query("xuda_emails", {
|
|
1148
|
-
// selector: {
|
|
1149
|
-
// docType: "email",
|
|
1150
|
-
// },
|
|
1151
|
-
// limit: 99999,
|
|
1152
|
-
// });
|
|
1153
|
-
// var email_docs = [];
|
|
1154
|
-
// for (let val of emails_ret.docs) {
|
|
1155
|
-
// val._deleted = true;
|
|
1156
|
-
// email_docs.push(val);
|
|
1157
|
-
// }
|
|
1158
|
-
|
|
1159
|
-
// await db_module.sava_couch_bulk_docs("xuda_emails", email_docs);
|
|
1160
|
-
|
|
1161
|
-
///////////////////////////////////
|
|
1162
|
-
return;
|
|
1163
|
-
const email_account_ret = await module.exports.get_email_accounts({
|
|
1164
|
-
uid,
|
|
1165
|
-
});
|
|
1166
|
-
|
|
1167
|
-
var accessToken;
|
|
1168
|
-
for await (let email_account of email_account_ret.data.docs) {
|
|
1169
|
-
switch (email_account.vendor) {
|
|
1170
|
-
case "gmail":
|
|
1171
|
-
const ret = await generate_gmail_access_token(email_account);
|
|
1172
|
-
accessToken = ret.access_token;
|
|
1173
|
-
break;
|
|
1174
|
-
|
|
1175
|
-
default:
|
|
1176
|
-
break;
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
module.exports.read_emails({
|
|
1180
|
-
uid,
|
|
1181
|
-
email_account_address: email_account.email,
|
|
1182
|
-
accessToken,
|
|
1183
|
-
email_account_id: email_account._id,
|
|
1184
|
-
vendor: email_account.vendor,
|
|
1185
|
-
});
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
// console.log(await module.exports.get_contact({ uid, name: "bo" }));
|
|
1189
|
-
}, 2000);
|
|
1190
|
-
|
|
1191
1130
|
exports.find_contact_duplicates = async function (req) {
|
|
1192
1131
|
const { uid, name } = req;
|
|
1193
1132
|
var opt = {
|
|
@@ -1453,3 +1392,64 @@ exports.get_account_rt_info = async function (uid) {
|
|
|
1453
1392
|
account_info.uid = doc_ret.data._id;
|
|
1454
1393
|
return account_info;
|
|
1455
1394
|
};
|
|
1395
|
+
|
|
1396
|
+
// setTimeout(async () => {
|
|
1397
|
+
// const uid = "0489f946c213947316647b468f029ed9"; //"aecc740881fd0a35098c738652000fab";
|
|
1398
|
+
|
|
1399
|
+
// // // clear data
|
|
1400
|
+
// // const contact_ret = await db_module.find_couch_query("xuda_contacts", {
|
|
1401
|
+
// // selector: {
|
|
1402
|
+
// // docType: "contact",
|
|
1403
|
+
// // },
|
|
1404
|
+
// // limit: 99999,
|
|
1405
|
+
// // });
|
|
1406
|
+
// // var contact_docs = [];
|
|
1407
|
+
// // for (let val of contact_ret.docs) {
|
|
1408
|
+
// // val._deleted = true;
|
|
1409
|
+
// // contact_docs.push(val);
|
|
1410
|
+
// // }
|
|
1411
|
+
// // await db_module.sava_couch_bulk_docs("xuda_contacts", contact_docs);
|
|
1412
|
+
|
|
1413
|
+
// // const emails_ret = await db_module.find_couch_query("xuda_emails", {
|
|
1414
|
+
// // selector: {
|
|
1415
|
+
// // docType: "email",
|
|
1416
|
+
// // },
|
|
1417
|
+
// // limit: 99999,
|
|
1418
|
+
// // });
|
|
1419
|
+
// // var email_docs = [];
|
|
1420
|
+
// // for (let val of emails_ret.docs) {
|
|
1421
|
+
// // val._deleted = true;
|
|
1422
|
+
// // email_docs.push(val);
|
|
1423
|
+
// // }
|
|
1424
|
+
|
|
1425
|
+
// // await db_module.sava_couch_bulk_docs("xuda_emails", email_docs);
|
|
1426
|
+
|
|
1427
|
+
// ///////////////////////////////////
|
|
1428
|
+
// return;
|
|
1429
|
+
// const email_account_ret = await module.exports.get_email_accounts({
|
|
1430
|
+
// uid,
|
|
1431
|
+
// });
|
|
1432
|
+
|
|
1433
|
+
// var accessToken;
|
|
1434
|
+
// for await (let email_account of email_account_ret.data.docs) {
|
|
1435
|
+
// switch (email_account.vendor) {
|
|
1436
|
+
// case "gmail":
|
|
1437
|
+
// const ret = await generate_gmail_access_token(email_account);
|
|
1438
|
+
// accessToken = ret.access_token;
|
|
1439
|
+
// break;
|
|
1440
|
+
|
|
1441
|
+
// default:
|
|
1442
|
+
// break;
|
|
1443
|
+
// }
|
|
1444
|
+
|
|
1445
|
+
// module.exports.read_emails({
|
|
1446
|
+
// uid,
|
|
1447
|
+
// email_account_address: email_account.email,
|
|
1448
|
+
// accessToken,
|
|
1449
|
+
// email_account_id: email_account._id,
|
|
1450
|
+
// vendor: email_account.vendor,
|
|
1451
|
+
// });
|
|
1452
|
+
// }
|
|
1453
|
+
|
|
1454
|
+
// // console.log(await module.exports.get_contact({ uid, name: "bo" }));
|
|
1455
|
+
// }, 2000);
|