feat(server): wip tax rates service

This commit is contained in:
Ahmed Bouhuolia
2023-08-11 01:31:52 +02:00
parent 26c6ca9e36
commit 04d134806b
16 changed files with 550 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
import { Inject, Service } from 'typedi';
import HasTenancyService from '../Tenancy/TenancyService';
import { CommandTaxRatesValidators } from './CommandTaxRatesValidators';
@Service()
export class GetTaxRateService {
@Inject()
private tenancy: HasTenancyService;
@Inject()
private validators: CommandTaxRatesValidators;
/**
*
* @param {number} tenantId
* @param {number} taxRateId
* @returns
*/
public async getTaxRate(tenantId: number, taxRateId: number) {
const { TaxRate } = this.tenancy.models(tenantId);
const taxRate = await TaxRate.query().findById(taxRateId);
this.validators.validateTaxRateExistance(taxRate);
return taxRate;
}
}