mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
refactor: financial reports to nestjs
This commit is contained in:
36
temp/CashFlow/CashflowTableInjectable.ts
Normal file
36
temp/CashFlow/CashflowTableInjectable.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { CashFlowTable } from './CashFlowTable';
|
||||
import { CashFlowStatementService } from './CashFlowService';
|
||||
import { I18nService } from 'nestjs-i18n';
|
||||
import {
|
||||
ICashFlowStatementQuery,
|
||||
ICashFlowStatementTable,
|
||||
} from './Cashflow.types';
|
||||
|
||||
@Injectable()
|
||||
export class CashflowTableInjectable {
|
||||
constructor(
|
||||
private readonly cashflowSheet: CashFlowStatementService,
|
||||
private readonly i18n: I18nService,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Retrieves the cash flow table.
|
||||
* @returns {Promise<ICashFlowStatementTable>}
|
||||
*/
|
||||
public async table(
|
||||
query: ICashFlowStatementQuery,
|
||||
): Promise<ICashFlowStatementTable> {
|
||||
const cashflowDOO = await this.cashflowSheet.cashFlow(query);
|
||||
const cashflowTable = new CashFlowTable(cashflowDOO, this.i18n);
|
||||
|
||||
return {
|
||||
table: {
|
||||
columns: cashflowTable.tableColumns(),
|
||||
rows: cashflowTable.tableRows(),
|
||||
},
|
||||
query: cashflowDOO.query,
|
||||
meta: cashflowDOO.meta,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user