From 608c74fd47d5b2ba3625b02311595177962a6850 Mon Sep 17 00:00:00 2001 From: Dazzlin00 Date: Fri, 28 Mar 2025 15:33:07 -0400 Subject: [PATCH] fix --- src/user/dto/user.dto.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/user/dto/user.dto.ts b/src/user/dto/user.dto.ts index 140c76d..273c2d8 100644 --- a/src/user/dto/user.dto.ts +++ b/src/user/dto/user.dto.ts @@ -1,5 +1,5 @@ import { ApiProperty } from '@nestjs/swagger'; -import { Transform, Expose } from 'class-transformer'; +import { Transform, Expose, TransformFnParams } from 'class-transformer'; import { IsDateString, IsEmail, @@ -22,15 +22,19 @@ export class UserDTO { @Expose() lastName: string; - @ApiProperty({ description: 'The email of the user', uniqueItems: true }) - @Transform(({ value }: { value: string }) => value.trim().toLowerCase()) + @ApiProperty({ description: 'El email del usuario', uniqueItems: true }) + @Transform(({ value }: TransformFnParams): string => { + return typeof value === 'string' ? value.trim().toLowerCase() : ''; + }) @IsNotEmpty() @IsEmail() @Expose() email: string; - @ApiProperty({ description: 'the password of the user' }) - @Transform(({ value }: { value: string }) => value.trim()) + @ApiProperty({ description: 'La contraseƱa del usuario' }) + @Transform(({ value }: TransformFnParams): string => { + return typeof value === 'string' ? value.trim() : ''; + }) @IsNotEmpty() @MinLength(8) password: string;