mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
feat(server): order tax rates by name
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Knex } from 'knex';
|
||||
import { Inject, Service } from 'typedi';
|
||||
import { omit } from 'lodash';
|
||||
import {
|
||||
IEditTaxRateDTO,
|
||||
ITaxRate,
|
||||
@@ -54,7 +55,7 @@ export class EditTaxRateService {
|
||||
private async editTaxRateOrCreate(
|
||||
tenantId: number,
|
||||
oldTaxRate: ITaxRate,
|
||||
editTaxRateDTO: any,
|
||||
editTaxRateDTO: IEditTaxRateDTO,
|
||||
trx?: Knex.Transaction
|
||||
) {
|
||||
const { TaxRate } = this.tenancy.models(tenantId);
|
||||
@@ -68,6 +69,7 @@ export class EditTaxRateService {
|
||||
|
||||
// Create a new tax rate with new edited data.
|
||||
return TaxRate.query(trx).insertAndFetch({
|
||||
...omit(oldTaxRate, ['id']),
|
||||
...editTaxRateDTO,
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -19,7 +19,8 @@ export class GetTaxRatesService {
|
||||
public async getTaxRates(tenantId: number) {
|
||||
const { TaxRate } = this.tenancy.models(tenantId);
|
||||
|
||||
const taxRates = await TaxRate.query();
|
||||
// Retrieves the tax rates.
|
||||
const taxRates = await TaxRate.query().orderBy('name', 'ASC');
|
||||
|
||||
// Transforms the tax rates.
|
||||
return this.transformer.transform(
|
||||
|
||||
Reference in New Issue
Block a user