mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
|
import { Inject } from 'typedi';
|
|
import { JournalSheetService } from './JournalSheetService';
|
|
import { IJournalReportQuery, IJournalTable } from '@/interfaces';
|
|
import { JournalSheetTable } from './JournalSheetTable';
|
|
|
|
export class JournalSheetTableInjectable {
|
|
@Inject()
|
|
private tenancy: HasTenancyService;
|
|
|
|
@Inject()
|
|
private journalSheetService: JournalSheetService;
|
|
|
|
/**
|
|
* Retrieves the journal sheet in table format.
|
|
* @param {number} tenantId
|
|
* @param {IJournalReportQuery} query
|
|
* @returns {Promise<IJournalTable>}
|
|
*/
|
|
public async table(
|
|
tenantId: number,
|
|
query: IJournalReportQuery
|
|
): Promise<IJournalTable> {
|
|
const journal = await this.journalSheetService.journalSheet(
|
|
tenantId,
|
|
query
|
|
);
|
|
const table = new JournalSheetTable(journal.data, journal.query, {});
|
|
|
|
return {
|
|
table: {
|
|
columns: table.tableColumns(),
|
|
rows: table.tableData(),
|
|
},
|
|
query: journal.query,
|
|
meta: journal.meta,
|
|
};
|
|
}
|
|
}
|