From 0ca98c7ae4415b5cf94b520644e2e7b976a929dc Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Fri, 27 Jun 2025 02:18:01 +0200 Subject: [PATCH] fix: cycle dependecy --- .../src/modules/PaymentLinks/PaymentLinks.module.ts | 7 +++++-- .../src/modules/SaleInvoices/SaleInvoices.module.ts | 2 ++ .../src/modules/StripePayment/StripePayment.module.ts | 8 ++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/server/src/modules/PaymentLinks/PaymentLinks.module.ts b/packages/server/src/modules/PaymentLinks/PaymentLinks.module.ts index 122c63970..4e1979802 100644 --- a/packages/server/src/modules/PaymentLinks/PaymentLinks.module.ts +++ b/packages/server/src/modules/PaymentLinks/PaymentLinks.module.ts @@ -1,4 +1,4 @@ -import { Module } from '@nestjs/common'; +import { forwardRef, Module } from '@nestjs/common'; import { CreateInvoiceCheckoutSession } from './CreateInvoiceCheckoutSession'; import { GetPaymentLinkInvoicePdf } from './GetPaymentLinkInvoicePdf'; import { PaymentLinksApplication } from './PaymentLinksApplication'; @@ -13,7 +13,10 @@ import { TenancyContext } from '../Tenancy/TenancyContext.service'; const models = [InjectSystemModel(PaymentLink)]; @Module({ - imports: [StripePaymentModule, SaleInvoicesModule], + imports: [ + forwardRef(() => StripePaymentModule), + forwardRef(() => SaleInvoicesModule), + ], providers: [ ...models, TenancyContext, diff --git a/packages/server/src/modules/SaleInvoices/SaleInvoices.module.ts b/packages/server/src/modules/SaleInvoices/SaleInvoices.module.ts index a88679f57..fa2ca82aa 100644 --- a/packages/server/src/modules/SaleInvoices/SaleInvoices.module.ts +++ b/packages/server/src/modules/SaleInvoices/SaleInvoices.module.ts @@ -58,6 +58,7 @@ import { PaymentsReceivedModule } from '../PaymentReceived/PaymentsReceived.modu import { SaleInvoicesCost } from './SalesInvoicesCost'; import { SaleInvoicesExportable } from './commands/SaleInvoicesExportable'; import { SaleInvoicesImportable } from './commands/SaleInvoicesImportable'; +import { PaymentLinksModule } from '../PaymentLinks/PaymentLinks.module'; @Module({ imports: [ @@ -74,6 +75,7 @@ import { SaleInvoicesImportable } from './commands/SaleInvoicesImportable'; MailModule, MailNotificationModule, forwardRef(() => InventoryCostModule), + forwardRef(() => PaymentLinksModule), DynamicListModule, BullModule.registerQueue({ name: SendSaleInvoiceQueue }), ], diff --git a/packages/server/src/modules/StripePayment/StripePayment.module.ts b/packages/server/src/modules/StripePayment/StripePayment.module.ts index bfde0398d..9ff83af2a 100644 --- a/packages/server/src/modules/StripePayment/StripePayment.module.ts +++ b/packages/server/src/modules/StripePayment/StripePayment.module.ts @@ -1,4 +1,4 @@ -import { Module } from '@nestjs/common'; +import { forwardRef, Module } from '@nestjs/common'; import { CreateStripeAccountLinkService } from './CreateStripeAccountLink'; import { CreateStripeAccountService } from './CreateStripeAccountService'; import { StripePaymentApplication } from './StripePaymentApplication'; @@ -19,7 +19,11 @@ import { TenancyContext } from '../Tenancy/TenancyContext.service'; const models = [InjectSystemModel(PaymentIntegration)]; @Module({ - imports: [AccountsModule, SaleInvoicesModule, PaymentsReceivedModule], + imports: [ + AccountsModule, + PaymentsReceivedModule, + forwardRef(() => SaleInvoicesModule), + ], providers: [ ...models, StripePaymentService,