mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
refactoring: balance sheet report.
refactoring: trial balance sheet report. refactoring: general ledger report. refactoring: journal report. refactoring: P&L report.
This commit is contained in:
@@ -1,16 +1,45 @@
|
||||
import { Container } from 'typedi';
|
||||
import TenancyService from 'services/Tenancy/TenancyService';
|
||||
import CachableRepository from './CachableRepository';
|
||||
|
||||
export default class TenantRepository {
|
||||
export default class TenantRepository extends CachableRepository {
|
||||
repositoryName: string;
|
||||
tenantId: number;
|
||||
tenancy: TenancyService;
|
||||
|
||||
modelsInstance: any;
|
||||
repositoriesInstance: any;
|
||||
cacheInstance: any;
|
||||
|
||||
/**
|
||||
* Constructor method.
|
||||
* @param {number} tenantId
|
||||
*/
|
||||
constructor(tenantId: number) {
|
||||
super();
|
||||
|
||||
this.tenantId = tenantId;
|
||||
this.tenancy = Container.get(TenancyService);
|
||||
this.repositoryName = this.constructor.name;
|
||||
}
|
||||
|
||||
get models() {
|
||||
if (!this.modelsInstance) {
|
||||
this.modelsInstance = this.tenancy.models(this.tenantId);
|
||||
}
|
||||
return this.modelsInstance;
|
||||
}
|
||||
|
||||
get repositories() {
|
||||
if (!this.repositoriesInstance) {
|
||||
this.repositoriesInstance = this.tenancy.repositories(this.tenantId);
|
||||
}
|
||||
return this.repositoriesInstance;
|
||||
}
|
||||
|
||||
get cache() {
|
||||
if (!this.cacheInstance) {
|
||||
this.cacheInstance = this.tenancy.cache(this.tenantId);
|
||||
}
|
||||
return this.cacheInstance;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user