refactor(nestjs): landed cost

This commit is contained in:
Ahmed Bouhuolia
2025-06-10 17:08:32 +02:00
parent fa180b3ac5
commit 1130975efd
20 changed files with 1511 additions and 10 deletions

View File

@@ -0,0 +1,45 @@
import {
IsInt,
IsIn,
IsOptional,
IsArray,
ValidateNested,
IsDecimal,
IsString,
IsNumber,
} from 'class-validator';
import { Type } from 'class-transformer';
import { ToNumber } from '@/common/decorators/Validators';
class AllocateBillLandedCostItemDto {
@IsInt()
@ToNumber()
entryId: number;
@IsDecimal()
cost: string; // Use string for IsDecimal, or use @IsNumber() if you want a number
}
export class AllocateBillLandedCostDto {
@IsInt()
@ToNumber()
transactionId: number;
@IsIn(['Expense', 'Bill'])
transactionType: string;
@IsInt()
transactionEntryId: number;
@IsIn(['value', 'quantity'])
allocationMethod: string;
@IsOptional()
@IsString()
description?: string | null;
@IsArray()
@ValidateNested({ each: true })
@Type(() => AllocateBillLandedCostItemDto)
items: AllocateBillLandedCostItemDto[];
}