Skip to content

Commit 9c176e0

Browse files
committed
set expiration_date to null rather than undefined
1 parent 4d5a657 commit 9c176e0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

repos/License.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface License {
99
license_type: LicenseType;
1010
status?: LicenseStatus;
1111
purchase_date: Date;
12-
expiration_date?: Date;
12+
expiration_date?: Date | null;
1313
stripe_customer_id?: string;
1414
stripe_payment_id?: string;
1515
created_at: Date;
@@ -20,7 +20,7 @@ export interface CreateLicenseData {
2020
user_id: string;
2121
license_type: LicenseType;
2222
status?: LicenseStatus;
23-
expiration_date?: Date;
23+
expiration_date?: Date | null;
2424
purchase_date?: Date;
2525
stripe_customer_id?: string;
2626
stripe_payment_id?: string;
@@ -31,7 +31,7 @@ export interface UpsertLicenseData {
3131
license_type: LicenseType;
3232
status: LicenseStatus;
3333
purchase_date: Date;
34-
expiration_date?: Date;
34+
expiration_date?: Date | null;
3535
stripe_customer_id?: string;
3636
stripe_payment_id?: string;
3737
}

services/WebhookService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const handleCheckoutSessionCompleted = async (session: Stripe.Checkout.Session):
4444
status: 'active',
4545
license_type: productConfig.licenseType,
4646
stripe_payment_id: session.subscription as string,
47-
expiration_date: undefined,
47+
expiration_date: null,
4848
updated_at: new Date()
4949
})
5050
return
@@ -58,7 +58,7 @@ const handleCheckoutSessionCompleted = async (session: Stripe.Checkout.Session):
5858
await LicenseRepo.updateLicense(existingSubscriptionLicense.id, {
5959
status: 'active',
6060
stripe_payment_id: session.subscription as string,
61-
expiration_date: undefined,
61+
expiration_date: null,
6262
updated_at: new Date()
6363
})
6464
console.log('Existing subscription license updated')
@@ -165,7 +165,7 @@ const handleSubscriptionUpdated = async (subscription: Stripe.Subscription): Pro
165165
console.log(`Subscription ${subscription.id} reactivated - removing expiration date`)
166166

167167
await LicenseRepo.updateLicense(license.id, {
168-
expiration_date: undefined,
168+
expiration_date: null,
169169
status: 'active',
170170
updated_at: new Date()
171171
})

0 commit comments

Comments
 (0)