mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
- 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
91 lines
1.8 KiB
TypeScript
91 lines
1.8 KiB
TypeScript
import { ToNumber } from '@/common/decorators/Validators';
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Transform } from 'class-transformer';
|
|
import {
|
|
IsBoolean,
|
|
IsNumber,
|
|
IsNotEmpty,
|
|
IsOptional,
|
|
IsString,
|
|
} from 'class-validator';
|
|
|
|
export class CommandTaxRateDto {
|
|
/**
|
|
* Tax rate name.
|
|
*/
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@ApiProperty({ description: 'The name of the tax rate.', example: 'VAT' })
|
|
name: string;
|
|
|
|
/**
|
|
* Tax rate code.
|
|
*/
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@ApiProperty({ description: 'The code of the tax rate.', example: 'VAT' })
|
|
code: string;
|
|
|
|
/**
|
|
* Tax rate percentage.
|
|
*/
|
|
@IsNumber()
|
|
@IsNotEmpty()
|
|
@ToNumber()
|
|
@ApiProperty({
|
|
description: 'The rate of the tax rate.',
|
|
example: 10,
|
|
})
|
|
rate: number;
|
|
|
|
/**
|
|
* Tax rate description.
|
|
*/
|
|
@IsString()
|
|
@IsOptional()
|
|
@ApiProperty({
|
|
description: 'The description of the tax rate.',
|
|
example: 'VAT',
|
|
})
|
|
description?: string;
|
|
|
|
/**
|
|
* Whether the tax is non-recoverable.
|
|
*/
|
|
@IsBoolean()
|
|
@IsOptional()
|
|
@Transform(({ value }) => value ?? false)
|
|
@ApiProperty({
|
|
description: 'Whether the tax is non-recoverable.',
|
|
example: false,
|
|
})
|
|
isNonRecoverable?: boolean;
|
|
|
|
/**
|
|
* Whether the tax is compound.
|
|
*/
|
|
@IsBoolean()
|
|
@IsOptional()
|
|
@Transform(({ value }) => value ?? false)
|
|
@ApiProperty({
|
|
description: 'Whether the tax is compound.',
|
|
example: false,
|
|
})
|
|
isCompound?: boolean;
|
|
|
|
/**
|
|
* Whether the tax rate is active.
|
|
*/
|
|
@IsBoolean()
|
|
@IsOptional()
|
|
@Transform(({ value }) => value ?? false)
|
|
@ApiProperty({
|
|
description: 'Whether the tax rate is active.',
|
|
example: false,
|
|
})
|
|
active?: boolean;
|
|
}
|
|
|
|
export class CreateTaxRateDto extends CommandTaxRateDto {}
|
|
export class EditTaxRateDto extends CommandTaxRateDto {}
|