diff --git a/packages/server/src/services/Accounting/LedgerStorageRevert.ts b/packages/server/src/services/Accounting/LedgerStorageRevert.ts index 0784c5d38..8d9b39971 100644 --- a/packages/server/src/services/Accounting/LedgerStorageRevert.ts +++ b/packages/server/src/services/Accounting/LedgerStorageRevert.ts @@ -10,7 +10,7 @@ export class LedgerRevert { private tenancy: HasTenancyService; @Inject() - ledgerStorage: LedgerStorageService; + private ledgerStorage: LedgerStorageService; /** * Reverts the jouranl entries. diff --git a/packages/server/src/services/CreditNotes/CreditNoteGLEntriesSubscriber.ts b/packages/server/src/services/CreditNotes/CreditNoteGLEntriesSubscriber.ts index 6df5d0322..8ca4b088f 100644 --- a/packages/server/src/services/CreditNotes/CreditNoteGLEntriesSubscriber.ts +++ b/packages/server/src/services/CreditNotes/CreditNoteGLEntriesSubscriber.ts @@ -5,18 +5,13 @@ import { ICreditNoteDeletedPayload, ICreditNoteEditedPayload, ICreditNoteOpenedPayload, - IRefundCreditNoteOpenedPayload, } from '@/interfaces'; import CreditNoteGLEntries from './CreditNoteGLEntries'; -import HasTenancyService from '@/services/Tenancy/TenancyService'; @Service() export default class CreditNoteGLEntriesSubscriber { @Inject() - creditNoteGLEntries: CreditNoteGLEntries; - - @Inject() - tenancy: HasTenancyService; + private creditNoteGLEntries: CreditNoteGLEntries; /** * Attaches events with handlers. diff --git a/packages/server/src/services/ManualJournals/CommandManualJournalValidators.ts b/packages/server/src/services/ManualJournals/CommandManualJournalValidators.ts index 01db91ca8..d6bbe0a8c 100644 --- a/packages/server/src/services/ManualJournals/CommandManualJournalValidators.ts +++ b/packages/server/src/services/ManualJournals/CommandManualJournalValidators.ts @@ -1,11 +1,10 @@ -import { difference, sumBy, omit, map } from 'lodash'; +import { difference } from 'lodash'; import { Service, Inject } from 'typedi'; import { ServiceError } from '@/exceptions'; import { IManualJournalDTO, IManualJournalEntry, IManualJournal, - IManualJournalEntryDTO, } from '@/interfaces'; import TenancyService from '@/services/Tenancy/TenancyService'; import { ERRORS } from './constants'; @@ -286,7 +285,7 @@ export class CommandManualJournalValidators { public validateJournalCurrencyWithAccountsCurrency = async ( tenantId: number, manualJournalDTO: IManualJournalDTO, - baseCurrency: string, + baseCurrency: string ) => { const { Account } = this.tenancy.models(tenantId); diff --git a/packages/server/src/services/ManualJournals/ManualJournalGLEntries.ts b/packages/server/src/services/ManualJournals/ManualJournalGLEntries.ts index dc3c4052f..9f8d419fc 100644 --- a/packages/server/src/services/ManualJournals/ManualJournalGLEntries.ts +++ b/packages/server/src/services/ManualJournals/ManualJournalGLEntries.ts @@ -3,25 +3,20 @@ import * as R from 'ramda'; import { IManualJournal, IManualJournalEntry, - IAccount, ILedgerEntry, } from '@/interfaces'; import { Knex } from 'knex'; import Ledger from '@/services/Accounting/Ledger'; import LedgerStorageService from '@/services/Accounting/LedgerStorageService'; import HasTenancyService from '@/services/Tenancy/TenancyService'; -import { LedgerRevert } from '@/services/Accounting/LedgerStorageRevert'; @Service() export class ManualJournalGLEntries { @Inject() - ledgerStorage: LedgerStorageService; + private ledgerStorage: LedgerStorageService; @Inject() - ledgerRevert: LedgerRevert; - - @Inject() - tenancy: HasTenancyService; + private tenancy: HasTenancyService; /** * Create manual journal GL entries. @@ -77,7 +72,7 @@ export class ManualJournalGLEntries { manualJournalId: number, trx?: Knex.Transaction ): Promise => { - return this.ledgerRevert.revertGLEntries( + return this.ledgerStorage.deleteByReference( tenantId, manualJournalId, 'Journal', @@ -86,7 +81,7 @@ export class ManualJournalGLEntries { }; /** - * + * Retrieves the ledger of the given manual journal. * @param {IManualJournal} manualJournal * @returns {Ledger} */ @@ -97,11 +92,13 @@ export class ManualJournalGLEntries { }; /** - * + * Retrieves the common entry details of the manual journal * @param {IManualJournal} manualJournal - * @returns {} + * @returns {Partial} */ - private getManualJournalCommonEntry = (manualJournal: IManualJournal) => { + private getManualJournalCommonEntry = ( + manualJournal: IManualJournal + ): Partial => { return { transactionNumber: manualJournal.journalNumber, referenceNumber: manualJournal.reference, @@ -118,7 +115,8 @@ export class ManualJournalGLEntries { }; /** - * + * Retrieves the ledger entry of the given manual journal and + * its associated entry. * @param {IManualJournal} manualJournal - * @param {IManualJournalEntry} entry - * @returns {ILedgerEntry} @@ -149,7 +147,7 @@ export class ManualJournalGLEntries { ); /** - * + * Retrieves the ledger of the given manual journal. * @param {IManualJournal} manualJournal * @returns {ILedgerEntry[]} */