- feat: Optimize tenancy software architecture.

This commit is contained in:
Ahmed Bouhuolia
2020-08-30 22:11:14 +02:00
parent 74321a2886
commit ca251a2d28
53 changed files with 1581 additions and 1055 deletions

View 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');
}
}