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() {
|
||||
const user = await this.$relatedQuery('user');
|
||||
|
||||
if (user.inTrial) {
|
||||
if (await user.inTrial()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const subscription = await this.$relatedQuery('subscription');
|
||||
|
||||
if (!subscription.isActive) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const plan = subscription.plan;
|
||||
|
||||
return this.consumedTaskCount >= plan.quota;
|
||||
|
Reference in New Issue
Block a user