From 19f9dcc1a7373a68c82ace88ae715f94ebc34770 Mon Sep 17 00:00:00 2001 From: bhavanakarwade Date: Fri, 1 Mar 2024 12:58:57 +0530 Subject: [PATCH] fix: ledger id validations Signed-off-by: bhavanakarwade --- apps/api-gateway/src/agent-service/dto/create-tenant.dto.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/api-gateway/src/agent-service/dto/create-tenant.dto.ts b/apps/api-gateway/src/agent-service/dto/create-tenant.dto.ts index 56d33e86c..4ee5d3388 100644 --- a/apps/api-gateway/src/agent-service/dto/create-tenant.dto.ts +++ b/apps/api-gateway/src/agent-service/dto/create-tenant.dto.ts @@ -1,7 +1,7 @@ import { trim } from '@credebl/common/cast.helper'; import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { Transform } from 'class-transformer'; -import { MaxLength, IsString, MinLength, Matches, IsNotEmpty, IsOptional, IsArray } from 'class-validator'; +import { MaxLength, IsString, MinLength, Matches, IsNotEmpty, IsOptional, IsArray, IsUUID } from 'class-validator'; const labelRegex = /^[a-zA-Z0-9 ]*$/; export class CreateTenantDto { @ApiProperty() @@ -28,6 +28,7 @@ export class CreateTenantDto { @ApiProperty({ example: ["b942473d-6fdd-4a38-b76e-a3314fca66b6"] }) @ApiPropertyOptional() @IsOptional() + @IsUUID(4, {each:true, message: "Please provide valid ledgerId"}) @IsArray({ message: 'ledgerId must be an array' }) @IsNotEmpty({ message: 'please provide valid ledgerId' }) @IsString({ each: true, message: 'Each ledgerId must be a string' })