The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Remove dumb code placement (#5494)
martmullec248f860529
diff --git a/packages/twenty-server/src/engine/core-modules/billing/billing.service.ts b/packages/twenty-server/src/engine/core-modules/billing/billing.service.tsindex 356cdec4e7f..8228788f463 100644--- a/packages/twenty-server/src/engine/core-modules/billing/billing.service.ts+++ b/packages/twenty-server/src/engine/core-modules/billing/billing.service.ts@@ -96,6 +96,12 @@ export class BillingService {return notCanceledSubscriptions?.[0];}+ async getBillingSubscription(stripeSubscriptionId: string) {+ return this.billingSubscriptionRepository.findOneOrFail({+ where: { stripeSubscriptionId },+ });+ }+async getStripeCustomerId(workspaceId: string) {const subscriptions = await this.billingSubscriptionRepository.find({where: { workspaceId },@@ -265,14 +271,6 @@ export class BillingService {subscriptionStatus: data.object.status,});- const billingSubscription = await this.getCurrentBillingSubscription({- workspaceId,- });-- if (!billingSubscription) {- return;- }-await this.billingSubscriptionRepository.upsert({workspaceId: workspaceId,@@ -287,6 +285,10 @@ export class BillingService {},);+ const billingSubscription = await this.getBillingSubscription(+ data.object.id,+ );+await this.billingSubscriptionItemRepository.upsert(data.object.items.data.map((item) => {return {