From 519fcae634b88ad485bec593d1fddcc8acc5dcf7 Mon Sep 17 00:00:00 2001
From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
Date: Sat, 26 Oct 2024 10:15:08 +0200
Subject: [PATCH] Various improvements
---
apps/api/src/app/subscription/subscription.controller.ts | 2 +-
apps/api/src/app/subscription/subscription.service.ts | 4 +++-
apps/client/src/app/components/header/header.component.html | 3 ++-
.../user-account-membership/user-account-membership.html | 3 ++-
apps/client/src/app/pages/pricing/pricing-page.html | 3 ++-
libs/common/src/lib/types/subscription-offer.type.ts | 6 +++++-
6 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/apps/api/src/app/subscription/subscription.controller.ts b/apps/api/src/app/subscription/subscription.controller.ts
index f4ca6d427..a042b2ea2 100644
--- a/apps/api/src/app/subscription/subscription.controller.ts
+++ b/apps/api/src/app/subscription/subscription.controller.ts
@@ -113,7 +113,7 @@ export class SubscriptionController {
@Post('stripe/checkout-session')
@UseGuards(AuthGuard('jwt'), HasPermissionGuard)
public async createCheckoutSession(
- @Body() { couponId, priceId }: { couponId: string; priceId: string }
+ @Body() { couponId, priceId }: { couponId?: string; priceId: string }
) {
try {
return this.subscriptionService.createCheckoutSession({
diff --git a/apps/api/src/app/subscription/subscription.service.ts b/apps/api/src/app/subscription/subscription.service.ts
index 545450669..7c1df023c 100644
--- a/apps/api/src/app/subscription/subscription.service.ts
+++ b/apps/api/src/app/subscription/subscription.service.ts
@@ -124,7 +124,9 @@ export class SubscriptionService {
let offer: SubscriptionOffer = price ? 'renewal' : 'default';
if (isBefore(createdAt, parseDate('2023-01-01'))) {
- offer = 'renewal-early-bird';
+ offer = 'renewal-early-bird-2023';
+ } else if (isBefore(createdAt, parseDate('2024-01-01'))) {
+ offer = 'renewal-early-bird-2024';
}
return {
diff --git a/apps/client/src/app/components/header/header.component.html b/apps/client/src/app/components/header/header.component.html
index 2e9c03122..ff36c2ebe 100644
--- a/apps/client/src/app/components/header/header.component.html
+++ b/apps/client/src/app/components/header/header.component.html
@@ -180,7 +180,8 @@
Upgrade Plan
} @else if (
user.subscription.offer === 'renewal' ||
- user.subscription.offer === 'renewal-early-bird'
+ user.subscription.offer === 'renewal-early-bird-2023' ||
+ user.subscription.offer === 'renewal-early-bird-2024'
) {
Renew Plan
}
diff --git a/apps/client/src/app/components/user-account-membership/user-account-membership.html b/apps/client/src/app/components/user-account-membership/user-account-membership.html
index 644ec0605..d30ce7bdd 100644
--- a/apps/client/src/app/components/user-account-membership/user-account-membership.html
+++ b/apps/client/src/app/components/user-account-membership/user-account-membership.html
@@ -16,7 +16,8 @@
Upgrade Plan
} @else if (
user.subscription.offer === 'renewal' ||
- user.subscription.offer === 'renewal-early-bird'
+ user.subscription.offer === 'renewal-early-bird-2023' ||
+ user.subscription.offer === 'renewal-early-bird-2024'
) {
Renew Plan
}
diff --git a/apps/client/src/app/pages/pricing/pricing-page.html b/apps/client/src/app/pages/pricing/pricing-page.html
index 1caa4e8a0..fe805ef62 100644
--- a/apps/client/src/app/pages/pricing/pricing-page.html
+++ b/apps/client/src/app/pages/pricing/pricing-page.html
@@ -278,7 +278,8 @@
Upgrade Plan
} @else if (
user.subscription.offer === 'renewal' ||
- user.subscription.offer === 'renewal-early-bird'
+ user.subscription.offer === 'renewal-early-bird-2023' ||
+ user.subscription.offer === 'renewal-early-bird-2024'
) {
Renew Plan
}
diff --git a/libs/common/src/lib/types/subscription-offer.type.ts b/libs/common/src/lib/types/subscription-offer.type.ts
index 180088b1e..98977da45 100644
--- a/libs/common/src/lib/types/subscription-offer.type.ts
+++ b/libs/common/src/lib/types/subscription-offer.type.ts
@@ -1 +1,5 @@
-export type SubscriptionOffer = 'default' | 'renewal' | 'renewal-early-bird';
+export type SubscriptionOffer =
+ | 'default'
+ | 'renewal'
+ | 'renewal-early-bird-2023'
+ | 'renewal-early-bird-2024';