feat(server): balance sheet meta

This commit is contained in:
Ahmed Bouhuolia
2024-02-17 00:21:48 +02:00
parent 27fed5f18a
commit 7690789031
10 changed files with 89 additions and 48 deletions

View File

@@ -0,0 +1,34 @@
import { TenantMetadata } from '@/system/models';
import { Inject, Service } from 'typedi';
import InventoryService from '../Inventory/Inventory';
import { IFinancialSheetCommonMeta } from '@/interfaces';
@Service()
export class FinancialSheetMeta {
@Inject()
private inventoryService: InventoryService;
/**
* Retrieves the common meta data of the financial sheet.
* @param {number} tenantId
* @returns {Promise<IFinancialSheetCommonMeta>}
*/
async meta(tenantId: number): Promise<IFinancialSheetCommonMeta> {
const tenantMetadata = await TenantMetadata.query().findOne({ tenantId });
const organizationName = tenantMetadata.name;
const baseCurrency = tenantMetadata.baseCurrency;
const dateFormat = tenantMetadata.dateFormat;
const isCostComputeRunning =
this.inventoryService.isItemsCostComputeRunning(tenantId);
return {
organizationName,
baseCurrency,
dateFormat,
isCostComputeRunning,
sheetName: '',
};
}
}