mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
refactor(nestjs): fix the failed e2e test cases
This commit is contained in:
@@ -3,6 +3,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||
import { LedgerStorageService } from '@/modules/Ledger/LedgerStorage.service';
|
||||
import { BankTransaction } from '../models/BankTransaction';
|
||||
import { BankTransactionGL } from './BankTransactionGL';
|
||||
import { TenantModelProxy } from '@/modules/System/models/TenantBaseModel';
|
||||
|
||||
@Injectable()
|
||||
export class BankTransactionGLEntriesService {
|
||||
@@ -10,12 +11,11 @@ export class BankTransactionGLEntriesService {
|
||||
private readonly ledgerStorage: LedgerStorageService,
|
||||
|
||||
@Inject(BankTransaction.name)
|
||||
private readonly bankTransactionModel: typeof BankTransaction,
|
||||
private readonly bankTransactionModel: TenantModelProxy<typeof BankTransaction>,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Write the journal entries of the given cashflow transaction.
|
||||
* @param {number} tenantId
|
||||
* @param {ICashflowTransaction} cashflowTransaction
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@@ -24,7 +24,7 @@ export class BankTransactionGLEntriesService {
|
||||
trx?: Knex.Transaction,
|
||||
): Promise<void> => {
|
||||
// Retrieves the cashflow transactions with associated entries.
|
||||
const transaction = await this.bankTransactionModel
|
||||
const transaction = await this.bankTransactionModel()
|
||||
.query(trx)
|
||||
.findById(cashflowTransactionId)
|
||||
.withGraphFetched('cashflowAccount')
|
||||
|
||||
@@ -4,12 +4,16 @@ import { BankTransaction } from '../models/BankTransaction';
|
||||
import { TransformerInjectable } from '@/modules/Transformer/TransformerInjectable.service';
|
||||
import { ServiceError } from '@/modules/Items/ServiceError';
|
||||
import { BankTransactionTransformer } from './BankTransactionTransformer';
|
||||
import { TenantModelProxy } from '@/modules/System/models/TenantBaseModel';
|
||||
|
||||
@Injectable()
|
||||
export class GetBankTransactionService {
|
||||
constructor(
|
||||
@Inject(BankTransaction.name)
|
||||
private readonly bankTransactionModel: typeof BankTransaction,
|
||||
private readonly bankTransactionModel: TenantModelProxy<
|
||||
typeof BankTransaction
|
||||
>,
|
||||
|
||||
private readonly transformer: TransformerInjectable,
|
||||
) {}
|
||||
|
||||
@@ -19,7 +23,7 @@ export class GetBankTransactionService {
|
||||
* @returns
|
||||
*/
|
||||
public async getBankTransaction(cashflowTransactionId: number) {
|
||||
const cashflowTransaction = await this.bankTransactionModel
|
||||
const cashflowTransaction = await this.bankTransactionModel()
|
||||
.query()
|
||||
.findById(cashflowTransactionId)
|
||||
.withGraphFetched('entries.cashflowAccount')
|
||||
|
||||
Reference in New Issue
Block a user