refactor: balance sheet to nestjs

This commit is contained in:
Ahmed Bouhuolia
2025-01-30 01:57:29 +02:00
parent 7b81d0c8e5
commit c4692d1716
51 changed files with 2823 additions and 287 deletions

View File

@@ -0,0 +1,36 @@
import moment from 'moment';
import { Injectable } from '@nestjs/common';
import { FinancialSheetMeta } from '../../common/FinancialSheetMeta';
import {
ICashFlowStatementMeta,
ICashFlowStatementQuery,
} from './Cashflow.types';
@Injectable()
export class CashflowSheetMeta {
constructor(private readonly financialSheetMeta: FinancialSheetMeta) {}
/**
* Cashflow sheet meta.
* @param {ICashFlowStatementQuery} query
* @returns {Promise<ICashFlowStatementMeta>}
*/
public async meta(
query: ICashFlowStatementQuery,
): Promise<ICashFlowStatementMeta> {
const meta = await this.financialSheetMeta.meta();
const formattedToDate = moment(query.toDate).format('YYYY/MM/DD');
const formattedFromDate = moment(query.fromDate).format('YYYY/MM/DD');
const formattedDateRange = `From ${formattedFromDate} | To ${formattedToDate}`;
const sheetName = 'Statement of Cash Flow';
return {
...meta,
sheetName,
formattedToDate,
formattedFromDate,
formattedDateRange,
};
}
}