Files
dh-inspeccion-v2/api-v3/src/administration/users/dto/update-user.dto.ts
T

44 lines
910 B
TypeScript

import { Transform } from 'class-transformer';
import {
IsEmail,
IsOptional,
IsString,
Matches,
MaxLength,
MinLength,
} from 'class-validator';
export class UpdateUserDto {
@Transform(({ value }) =>
typeof value === 'string' ? value.trim().toLowerCase() : value,
)
@IsOptional()
@IsString()
@MinLength(3)
@MaxLength(80)
@Matches(/^[a-zA-Z0-9._-]+$/)
username?: string;
@Transform(({ value }) =>
typeof value === 'string' ? value.trim().toLowerCase() : value,
)
@IsOptional()
@IsEmail()
@MaxLength(320)
email?: string | null;
@Transform(({ value }) => (typeof value === 'string' ? value.trim() : value))
@IsOptional()
@IsString()
@MinLength(1)
@MaxLength(120)
firstName?: string;
@Transform(({ value }) => (typeof value === 'string' ? value.trim() : value))
@IsOptional()
@IsString()
@MinLength(1)
@MaxLength(120)
lastName?: string;
}