refactor: migrate ledger writer to nestjs

This commit is contained in:
Ahmed Bouhuolia
2025-01-01 12:11:58 +02:00
parent 3ad34ba56f
commit 505c4b28a5
45 changed files with 880 additions and 777 deletions

View File

@@ -14,7 +14,7 @@ import { DeletePaymentReceivedService } from './commands/DeletePaymentReceived.s
import { GetPaymentReceivedService } from './queries/GetPaymentReceived.service';
import { GetPaymentReceivedInvoices } from './queries/GetPaymentReceivedInvoices.service';
// import { PaymentReceiveNotifyBySms } from './PaymentReceivedSmsNotify';
import GetPaymentReceivedPdf from './queries/GetPaymentReceivedPdf.service';
import { GetPaymentReceivedPdfService } from './queries/GetPaymentReceivedPdf.service';
// import { SendPaymentReceiveMailNotification } from './PaymentReceivedMailNotification';
import { GetPaymentReceivedStateService } from './queries/GetPaymentReceivedState.service';
@@ -29,7 +29,7 @@ export class PaymentReceivesApplication {
private getPaymentReceiveInvoicesService: GetPaymentReceivedInvoices,
// private paymentSmsNotify: PaymentReceiveNotifyBySms,
// private paymentMailNotify: SendPaymentReceiveMailNotification,
private getPaymentReceivePdfService: GetPaymentReceivedPdf,
private getPaymentReceivePdfService: GetPaymentReceivedPdfService,
private getPaymentReceivedStateService: GetPaymentReceivedStateService,
) {}

View File

@@ -24,6 +24,8 @@ import { PaymentReceivedGLEntriesSubscriber } from './subscribers/PaymentReceive
import { PaymentReceivedGLEntries } from './commands/PaymentReceivedGLEntries';
import { PaymentReceivedSyncInvoicesSubscriber } from './subscribers/PaymentReceivedSyncInvoices';
import { PaymentReceivedInvoiceSync } from './commands/PaymentReceivedInvoiceSync.service';
import { LedgerModule } from '../Ledger/Ledger.module';
import { AccountsModule } from '../Accounts/Accounts.module';
@Module({
controllers: [PaymentReceivesController],
@@ -55,6 +57,8 @@ import { PaymentReceivedInvoiceSync } from './commands/PaymentReceivedInvoiceSyn
WarehousesModule,
PdfTemplatesModule,
AutoIncrementOrdersModule,
LedgerModule,
AccountsModule
],
})
export class PaymentsReceivedModule {}

View File

@@ -7,6 +7,7 @@ import { AccountRepository } from '@/modules/Accounts/repositories/Account.repos
import { Injectable } from '@nestjs/common';
import { Inject } from '@nestjs/common';
import { TenancyContext } from '@/modules/Tenancy/TenancyContext.service';
import { Account } from '@/modules/Accounts/models/Account.model';
@Injectable()
export class PaymentReceivedGLEntries {
@@ -98,7 +99,8 @@ export class PaymentReceivedGLEntries {
// Exchange gain/loss account.
const exGainLossAccount = await this.accountRepository.findBySlug(
'exchange-grain-loss'
);
) as Account;
const paymentReceivedGL = new PaymentReceivedGL(paymentReceive)
.setARAccountId(receivableAccount.id)
.setExchangeGainOrLossAccountId(exGainLossAccount.id)

View File

@@ -1,8 +1,7 @@
import { Inject, Injectable } from '@nestjs/common';
import { Injectable } from '@nestjs/common';
import { defaultPaymentReceivedPdfTemplateAttributes } from '../constants';
import { GetPdfTemplateService } from '../../PdfTemplate/queries/GetPdfTemplate.service';
import { GetOrganizationBrandingAttributesService } from '../../PdfTemplate/queries/GetOrganizationBrandingAttributes.service';
import { PdfTemplateModel } from '../../PdfTemplate/models/PdfTemplate';
import { mergePdfTemplateWithDefaultAttributes } from '../../SaleInvoices/utils';
@Injectable()
@@ -10,9 +9,6 @@ export class PaymentReceivedBrandingTemplate {
constructor(
private readonly getPdfTemplateService: GetPdfTemplateService,
private readonly getOrgBrandingAttributes: GetOrganizationBrandingAttributesService,
@Inject(PdfTemplateModel.name)
private readonly pdfTemplateModel: typeof PdfTemplateModel,
) {}
/**