feat: Check if user has active subscription or not for execution
This commit is contained in:
@@ -50,12 +50,16 @@ class UsageData extends Base {
|
|||||||
async checkIfLimitExceeded() {
|
async checkIfLimitExceeded() {
|
||||||
const user = await this.$relatedQuery('user');
|
const user = await this.$relatedQuery('user');
|
||||||
|
|
||||||
if (user.inTrial) {
|
if (await user.inTrial()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const subscription = await this.$relatedQuery('subscription');
|
const subscription = await this.$relatedQuery('subscription');
|
||||||
|
|
||||||
|
if (!subscription.isActive) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const plan = subscription.plan;
|
const plan = subscription.plan;
|
||||||
|
|
||||||
return this.consumedTaskCount >= plan.quota;
|
return this.consumedTaskCount >= plan.quota;
|
||||||
|
Reference in New Issue
Block a user