@xuda.io/account_module 1.2.101 → 1.2.102
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 +4 -19
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -182,7 +182,7 @@ exports.increment_account_usage = async function (req) {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
if (Date.now() - doc.ts >= interval) {
|
|
185
|
-
const plan = _conf.PLAN_OBJ[account_data.
|
|
185
|
+
const plan = _conf.PLAN_OBJ[account_data.membership_plan];
|
|
186
186
|
const drive_size_total = account_data.user_drive_size + account_data.studio_drive_size + account_data.workspace_drive_size + account_data.builds_drive_size + account_data.plugins_drive_size;
|
|
187
187
|
if (bytesToGB(drive_size_total) > plan.features.drive) {
|
|
188
188
|
var price_per_hour = (bytesToGB(drive_size_total) * _conf.PRICE_OBJ.price_per_gb_drive) / _conf.PRICE_OBJ.avg_hours_in_month;
|
|
@@ -389,7 +389,7 @@ exports.get_account_data = async function (req) {
|
|
|
389
389
|
_id: acc_obj._id,
|
|
390
390
|
account_info: acc_obj.account_info,
|
|
391
391
|
usage: acc_obj.activity_usage,
|
|
392
|
-
plan: acc_obj.
|
|
392
|
+
plan: acc_obj.membership_plan,
|
|
393
393
|
plan_changed: acc_obj.plan_changed,
|
|
394
394
|
plan_info: acc_obj.plan_info,
|
|
395
395
|
support_plan: acc_obj.support_plan,
|
|
@@ -572,7 +572,7 @@ exports.validate_user_plan = async function (req) {
|
|
|
572
572
|
if (ret.code < 0) {
|
|
573
573
|
return ret;
|
|
574
574
|
}
|
|
575
|
-
var plan = _conf.PLAN_OBJ[ret.data.
|
|
575
|
+
var plan = _conf.PLAN_OBJ[ret.data.membership_plan];
|
|
576
576
|
// get plan from user
|
|
577
577
|
|
|
578
578
|
if (!plan) {
|
|
@@ -583,7 +583,7 @@ exports.validate_user_plan = async function (req) {
|
|
|
583
583
|
if (app_obj.app_type === 'master' && ret_obj.master >= plan.features.projects) {
|
|
584
584
|
return {
|
|
585
585
|
code: -8,
|
|
586
|
-
data: `Number of projects (${ret.data.
|
|
586
|
+
data: `Number of projects (${ret.data.membership_plan}) exceeds to the ${plan.features.projects} plan limits`,
|
|
587
587
|
};
|
|
588
588
|
}
|
|
589
589
|
|
|
@@ -602,21 +602,6 @@ exports.validate_user_plan = async function (req) {
|
|
|
602
602
|
};
|
|
603
603
|
}
|
|
604
604
|
|
|
605
|
-
// if (!app_obj.access_type) {
|
|
606
|
-
// return {
|
|
607
|
-
// code: -10,
|
|
608
|
-
// data: `error - access_type missing`,
|
|
609
|
-
// };
|
|
610
|
-
// }
|
|
611
|
-
// }
|
|
612
|
-
|
|
613
|
-
// if (app_obj.app_type === "backup" && ret.data.plan === "free") {
|
|
614
|
-
// return {
|
|
615
|
-
// code: -10,
|
|
616
|
-
// 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.`,
|
|
617
|
-
// };
|
|
618
|
-
// }
|
|
619
|
-
|
|
620
605
|
return { code: 1, data: ret.data };
|
|
621
606
|
};
|
|
622
607
|
|