fix: tax rates API and UI improvements

- Add @ToNumber() decorator to rate field for proper validation
- Fix getTaxRates to return { data: taxRates } response
- Fix useTaxRate URL typo and response handling
- Fix activate/inactivate endpoint methods and paths
- Apply TEXT_MUTED class to description and compound tax
- Add dark mode support for rate number display
This commit is contained in:
Ahmed Bouhuolia
2026-02-12 20:06:49 +02:00
parent 5a017104ce
commit e0d9a56a29
6 changed files with 31 additions and 23 deletions

View File

@@ -62,10 +62,11 @@ export class TaxRatesApplication {
/**
* Retrieves the tax rates list.
* @returns {Promise<ITaxRate[]>}
* @returns {Promise<{ data: ITaxRate[] }>}
*/
public getTaxRates() {
return this.getTaxRatesService.getTaxRates();
public async getTaxRates() {
const taxRates = await this.getTaxRatesService.getTaxRates();
return { data: taxRates };
}
/**

View File

@@ -85,9 +85,14 @@ export class TaxRatesController {
status: 200,
description: 'The tax rates have been successfully retrieved.',
schema: {
type: 'array',
items: {
$ref: getSchemaPath(TaxRateResponseDto),
type: 'object',
properties: {
data: {
type: 'array',
items: {
$ref: getSchemaPath(TaxRateResponseDto),
},
},
},
},
})

View File

@@ -1,3 +1,4 @@
import { ToNumber } from '@/common/decorators/Validators';
import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import {
@@ -30,6 +31,7 @@ export class CommandTaxRateDto {
*/
@IsNumber()
@IsNotEmpty()
@ToNumber()
@ApiProperty({
description: 'The rate of the tax rate.',
example: 10,