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