mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat(server): wip tax rates service
This commit is contained in:
28
packages/server/src/services/TaxRates/GetTaxRate.ts
Normal file
28
packages/server/src/services/TaxRates/GetTaxRate.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user