From 7e0603776f88a7e77aa8496a21661a0b852bc5de Mon Sep 17 00:00:00 2001 From: ArafatHossain403 Date: Sat, 21 Dec 2024 23:53:52 +0600 Subject: [PATCH] user registration company name and password max length set for unhandled error in backend --- .../src/dtos/auth/create.org.user.dto.ts | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/libraries/nestjs-libraries/src/dtos/auth/create.org.user.dto.ts b/libraries/nestjs-libraries/src/dtos/auth/create.org.user.dto.ts index 0505e2b00..25f633a94 100644 --- a/libraries/nestjs-libraries/src/dtos/auth/create.org.user.dto.ts +++ b/libraries/nestjs-libraries/src/dtos/auth/create.org.user.dto.ts @@ -1,29 +1,31 @@ -import {IsDefined, IsEmail, IsString, MinLength, ValidateIf} from "class-validator"; +import {IsDefined, IsEmail, IsString, MaxLength, MinLength, ValidateIf} from "class-validator"; import {Provider} from '@prisma/client'; export class CreateOrgUserDto { - @IsString() - @MinLength(3) - @IsDefined() - @ValidateIf(o => !o.providerToken) - password: string; + @IsString() + @MinLength(3) + @MaxLength(64) + @IsDefined() + @ValidateIf((o) => !o.providerToken) + password: string; - @IsString() - @IsDefined() - provider: Provider; + @IsString() + @IsDefined() + provider: Provider; - @IsString() - @IsDefined() - @ValidateIf(o => !o.password) - providerToken: string; + @IsString() + @IsDefined() + @ValidateIf((o) => !o.password) + providerToken: string; - @IsEmail() - @IsDefined() - @ValidateIf(o => !o.providerToken) - email: string; + @IsEmail() + @IsDefined() + @ValidateIf((o) => !o.providerToken) + email: string; - @IsString() - @IsDefined() - @MinLength(3) - company: string; + @IsString() + @IsDefined() + @MinLength(3) + @MaxLength(128) + company: string; }