From 4e2c7f85ef69424a27dc9a57b6774d19263bce80 Mon Sep 17 00:00:00 2001 From: enlineawork Date: Mon, 7 Sep 2026 14:12:09 -0300 Subject: [PATCH] =?UTF-8?q?F3.1:=20ampliar=20edici=C3=B3n=20del=20perfil?= =?UTF-8?q?=20de=20usuario?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../users/dto/update-user.dto.ts | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/api-v3/src/administration/users/dto/update-user.dto.ts b/api-v3/src/administration/users/dto/update-user.dto.ts index 0fa1e0f..76cb1d0 100644 --- a/api-v3/src/administration/users/dto/update-user.dto.ts +++ b/api-v3/src/administration/users/dto/update-user.dto.ts @@ -8,6 +8,9 @@ import { MinLength, } from 'class-validator'; +const optionalText = ({ value }: { value: unknown }) => + typeof value === 'string' && value.trim() ? value.trim() : null; + export class UpdateUserDto { @Transform(({ value }) => typeof value === 'string' ? value.trim().toLowerCase() : value, @@ -20,13 +23,38 @@ export class UpdateUserDto { username?: string; @Transform(({ value }) => - typeof value === 'string' ? value.trim().toLowerCase() : value, + typeof value === 'string' && value.trim() ? value.trim().toLowerCase() : null, ) @IsOptional() @IsEmail() @MaxLength(320) email?: string | null; + @Transform(({ value }) => + typeof value === 'string' && value.trim() ? value.replace(/\D/g, '') : null, + ) + @IsOptional() + @Matches(/^\d{7,11}$/) + dni?: string | null; + + @Transform(optionalText) + @IsOptional() + @IsString() + @MaxLength(40) + phone?: string | null; + + @Transform(optionalText) + @IsOptional() + @IsString() + @MaxLength(160) + jobTitle?: string | null; + + @Transform(optionalText) + @IsOptional() + @IsString() + @MaxLength(80) + employeeNumber?: string | null; + @Transform(({ value }) => (typeof value === 'string' ? value.trim() : value)) @IsOptional() @IsString()