fix(server): only returns active subscriptions (#6590)

This commit is contained in:
liuyi authored and GitHub committed 2024-04-17 16:19:34 +08:00
1 parent c7373d4651
commit 5b315bfc81
2 files changed
+4 -1

No files matched your search

@@ -369,6 +369,7 @@ export class UserSubscriptionResolver {
return this.db.userSubscription.findMany({ return this.db.userSubscription.findMany({
where: { where: {
userId: user.id, userId: user.id,
status: SubscriptionStatus.Active,
}, },
}); });
} }
@@ -765,7 +765,9 @@ export class SubscriptionService {
); );
return { return {
price, price,
coupon: !subscribed ? CouponType.ProEarlyAccessOneYearFree : undefined, coupon: canHaveEADiscount
? CouponType.ProEarlyAccessOneYearFree
: undefined,
}; };
} else { } else {
const isAIEaUser = await this.features.isEarlyAccessUser( const isAIEaUser = await this.features.isEarlyAccessUser(