mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
refactor(nestjs): landed cost
This commit is contained in:
@@ -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[];
|
||||
}
|
||||
Reference in New Issue
Block a user