This commit is contained in:
Ahmed Bouhuolia
2026-01-24 13:59:43 +02:00
parent ca910ee489
commit 04d065b969
29 changed files with 174 additions and 95 deletions

View File

@@ -2,11 +2,13 @@ import { ApiProperty } from '@nestjs/swagger';
import {
IsISO8601,
IsInt,
IsNotEmpty,
IsNumber,
Min,
IsBoolean,
IsEmail,
IsString,
ValidateIf,
} from 'class-validator';
import { ContactAddressDto } from '@/modules/Customers/dtos/ContactAddress.dto';
import { IsOptional, ToNumber } from '@/common/decorators/Validators';
@@ -30,8 +32,12 @@ export class CreateVendorDto extends ContactAddressDto {
@ToNumber()
openingBalanceExchangeRate?: number;
@ApiProperty({ required: false, description: 'Date of the opening balance' })
@IsOptional()
@ApiProperty({
required: false,
description: 'Date of the opening balance (required when openingBalance is provided)',
})
@ValidateIf((o) => o.openingBalance != null)
@IsNotEmpty({ message: 'openingBalanceAt is required when openingBalance is provided' })
@IsISO8601()
openingBalanceAt?: Date;