mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
- feat: Optimize tenancy software architecture.
This commit is contained in:
21
server/src/services/Tenancy/TenancyService.ts
Normal file
21
server/src/services/Tenancy/TenancyService.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Container } from 'typedi';
|
||||
|
||||
export default class HasTenancyService {
|
||||
/**
|
||||
* Retrieve the given tenant container.
|
||||
* @param {number} tenantId
|
||||
* @return {Container}
|
||||
*/
|
||||
tenantContainer(tenantId: number) {
|
||||
return Container.of(`tenant-${tenantId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve models of the givne tenant id.
|
||||
* @param {number} tenantId - The tenant id.
|
||||
*/
|
||||
models(tenantId: number) {
|
||||
console.log(tenantId);
|
||||
return this.tenantContainer(tenantId).get('models');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user