fix: accounts types caching.

This commit is contained in:
Ahmed Bouhuolia
2020-09-30 11:45:25 +02:00
parent 4e8c670968
commit 7d8b05ff66
6 changed files with 99 additions and 23 deletions

View File

@@ -0,0 +1,19 @@
import { Inject, Service } from 'typedi';
import TenancyService from 'services/Tenancy/TenancyService';
import { IAccountsTypesService, IAccountType } from 'interfaces';
@Service()
export default class AccountsTypesService implements IAccountsTypesService{
@Inject()
tenancy: TenancyService;
/**
* Retrieve all accounts types.
* @param {number} tenantId -
* @return {Promise<IAccountType>}
*/
getAccountsTypes(tenantId: number): Promise<IAccountType> {
const { accountTypeRepository } = this.tenancy.repositories(tenantId);
return accountTypeRepository.all();
}
}