mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-10 05:23:40 +03:00
fix(server): only treat active subscription as existing (#4826)
This commit is contained in:
parent
fb0aaabe53
commit
f6cfe7c8a1
@ -112,13 +112,14 @@ export class SubscriptionService {
|
||||
redirectUrl: string;
|
||||
idempotencyKey: string;
|
||||
}) {
|
||||
const currentSubscription = await this.db.userSubscription.findUnique({
|
||||
const currentSubscription = await this.db.userSubscription.findFirst({
|
||||
where: {
|
||||
userId: user.id,
|
||||
status: SubscriptionStatus.Active,
|
||||
},
|
||||
});
|
||||
|
||||
if (currentSubscription && currentSubscription.end < new Date()) {
|
||||
if (currentSubscription) {
|
||||
throw new Error('You already have a subscription');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user