mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
feat(nestjs): migrate to NestJS
This commit is contained in:
88
packages/server/src/modules/TaxRates/TaxRate.application.ts
Normal file
88
packages/server/src/modules/TaxRates/TaxRate.application.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
import { CreateTaxRate } from './commands/CreateTaxRate.service';
|
||||
import { DeleteTaxRateService } from './commands/DeleteTaxRate.service';
|
||||
import { EditTaxRateService } from './commands/EditTaxRate.service';
|
||||
import { GetTaxRateService } from './queries/GetTaxRate.service';
|
||||
import { ActivateTaxRateService } from './commands/ActivateTaxRate.service';
|
||||
import { InactivateTaxRateService } from './commands/InactivateTaxRate';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { GetTaxRatesService } from './queries/GetTaxRates.service';
|
||||
import { CreateTaxRateDto, EditTaxRateDto } from './dtos/TaxRate.dto';
|
||||
|
||||
@Injectable()
|
||||
export class TaxRatesApplication {
|
||||
constructor(
|
||||
private readonly createTaxRateService: CreateTaxRate,
|
||||
private readonly editTaxRateService: EditTaxRateService,
|
||||
private readonly deleteTaxRateService: DeleteTaxRateService,
|
||||
private readonly getTaxRateService: GetTaxRateService,
|
||||
private readonly activateTaxRateService: ActivateTaxRateService,
|
||||
private readonly inactivateTaxRateService: InactivateTaxRateService,
|
||||
private readonly getTaxRatesService: GetTaxRatesService,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Creates a new tax rate.
|
||||
* @param {ICreateTaxRateDTO} createTaxRateDTO
|
||||
* @returns {Promise<ITaxRate>}
|
||||
*/
|
||||
public createTaxRate(createTaxRateDTO: CreateTaxRateDto) {
|
||||
return this.createTaxRateService.createTaxRate(createTaxRateDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the given tax rate.
|
||||
* @param {number} tenantId
|
||||
* @param {number} taxRateId
|
||||
* @param {IEditTaxRateDTO} taxRateEditDTO
|
||||
* @returns {Promise<ITaxRate>}
|
||||
*/
|
||||
public editTaxRate(taxRateId: number, editTaxRateDTO: EditTaxRateDto) {
|
||||
return this.editTaxRateService.editTaxRate(taxRateId, editTaxRateDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the given tax rate.
|
||||
* @param {number} tenantId
|
||||
* @param {number} taxRateId
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
public deleteTaxRate(taxRateId: number) {
|
||||
return this.deleteTaxRateService.deleteTaxRate(taxRateId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the given tax rate.
|
||||
* @param {number} tenantId
|
||||
* @param {number} taxRateId
|
||||
* @returns {Promise<ITaxRate>}
|
||||
*/
|
||||
public getTaxRate(taxRateId: number) {
|
||||
return this.getTaxRateService.getTaxRate(taxRateId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the tax rates list.
|
||||
* @returns {Promise<ITaxRate[]>}
|
||||
*/
|
||||
public getTaxRates() {
|
||||
return this.getTaxRatesService.getTaxRates();
|
||||
}
|
||||
|
||||
/**
|
||||
* Activates the given tax rate.
|
||||
* @param {number} tenantId
|
||||
* @param {number} taxRateId
|
||||
*/
|
||||
public activateTaxRate(taxRateId: number) {
|
||||
return this.activateTaxRateService.activateTaxRate(taxRateId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inactivates the given tax rate.
|
||||
* @param {number} tenantId
|
||||
* @param {number} taxRateId
|
||||
*/
|
||||
public inactivateTaxRate(taxRateId: number) {
|
||||
return this.inactivateTaxRateService.inactivateTaxRate(taxRateId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user