mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 13:25:18 +00:00
fix: check db initialisation on getOrCreateCloudUser
This commit is contained in:
@@ -86,16 +86,12 @@ async function handleUserSubscriptionUpdate(
|
||||
if (!user) {
|
||||
const customer = (await stripeClient.customers.retrieve(customerId)) as Stripe.Customer
|
||||
console.log(`User not found for customer ${customerId}, creating new user with email ${customer.email}`)
|
||||
|
||||
|
||||
user = await getOrCreateCloudUser(customer.email as string, {
|
||||
email: customer.email as string,
|
||||
name: customer.name as string,
|
||||
stripeCustomerId: customer.id,
|
||||
})
|
||||
|
||||
if (await isDatabaseEmpty(user.id)) {
|
||||
await createUserDefaults(user.id)
|
||||
}
|
||||
}
|
||||
|
||||
const newMembershipExpiresAt = new Date(item.current_period_end * 1000)
|
||||
|
||||
Reference in New Issue
Block a user