F3.1: ampliar edición del perfil de usuario

This commit is contained in:
2026-09-07 14:12:09 -03:00
parent 9ece0c1100
commit 4e2c7f85ef
@@ -8,6 +8,9 @@ import {
MinLength, MinLength,
} from 'class-validator'; } from 'class-validator';
const optionalText = ({ value }: { value: unknown }) =>
typeof value === 'string' && value.trim() ? value.trim() : null;
export class UpdateUserDto { export class UpdateUserDto {
@Transform(({ value }) => @Transform(({ value }) =>
typeof value === 'string' ? value.trim().toLowerCase() : value, typeof value === 'string' ? value.trim().toLowerCase() : value,
@@ -20,13 +23,38 @@ export class UpdateUserDto {
username?: string; username?: string;
@Transform(({ value }) => @Transform(({ value }) =>
typeof value === 'string' ? value.trim().toLowerCase() : value, typeof value === 'string' && value.trim() ? value.trim().toLowerCase() : null,
) )
@IsOptional() @IsOptional()
@IsEmail() @IsEmail()
@MaxLength(320) @MaxLength(320)
email?: string | null; 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)) @Transform(({ value }) => (typeof value === 'string' ? value.trim() : value))
@IsOptional() @IsOptional()
@IsString() @IsString()