fix: passing number format to reports

This commit is contained in:
Ahmed Bouhuolia
2025-12-11 00:19:55 +02:00
parent d006362be2
commit 340b78d968
20 changed files with 308 additions and 163 deletions

View File

@@ -1,4 +1,4 @@
import { Type } from 'class-transformer';
import { Transform, Type } from 'class-transformer';
import {
IsBoolean,
IsEnum,
@@ -7,6 +7,7 @@ import {
IsPositive,
} from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger';
import { parseBoolean } from '@/utils/parse-boolean';
export class NumberFormatQueryDto {
@ApiPropertyOptional({
@@ -24,6 +25,7 @@ export class NumberFormatQueryDto {
example: false,
})
@IsBoolean()
@Transform(({ value }) => parseBoolean(value, false))
@IsOptional()
readonly divideOn1000: boolean;
@@ -32,6 +34,7 @@ export class NumberFormatQueryDto {
example: true,
})
@IsBoolean()
@Transform(({ value }) => parseBoolean(value, false))
@IsOptional()
readonly showZero: boolean;

View File

@@ -81,6 +81,7 @@ export class CashFlowStatementQueryDto extends FinancialSheetBranchesQueryDto {
})
@ValidateNested()
@Type(() => NumberFormatQueryDto)
@IsOptional()
numberFormat: NumberFormatQueryDto;
@ApiProperty({

View File

@@ -32,7 +32,7 @@ export class InventoryItemDetailsQueryDto {
@ApiPropertyOptional({
description: 'Number format for the inventory item details',
})
numberFormat: INumberFormatQuery;
numberFormat: NumberFormatQueryDto;
@Transform(({ value }) => parseBoolean(value, false))
@IsBoolean()

View File

@@ -7,11 +7,13 @@ import {
IsEnum,
IsOptional,
IsString,
ValidateNested,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Transform, Type } from 'class-transformer';
import { ToNumber } from '@/common/decorators/Validators';
import { parseBoolean } from '@/utils/parse-boolean';
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
export class ProfitLossSheetQueryDto extends FinancialSheetBranchesQueryDto {
@IsString()
@@ -30,8 +32,10 @@ export class ProfitLossSheetQueryDto extends FinancialSheetBranchesQueryDto {
toDate: moment.MomentInput;
@ApiProperty({ description: 'Number format configuration' })
@Type(() => Object)
numberFormat: INumberFormatQuery;
@ValidateNested()
@Type(() => NumberFormatQueryDto)
@IsOptional()
numberFormat: NumberFormatQueryDto;
@IsBoolean()
@Transform(({ value }) => parseBoolean(value, false))