37 lines
570 B
TypeScript
37 lines
570 B
TypeScript
import {
|
|
IsEnum,
|
|
IsOptional,
|
|
IsString,
|
|
IsUrl,
|
|
Length,
|
|
Matches,
|
|
ValidateIf,
|
|
} from 'class-validator';
|
|
import { UserRole } from '../enums/user-role.enum';
|
|
|
|
export class UpdateUserDto {
|
|
@IsOptional()
|
|
@IsString()
|
|
@Length(1, 100)
|
|
firstName?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@Length(1, 100)
|
|
lastName?: string;
|
|
|
|
@IsOptional()
|
|
@Matches(/^09\d{9}$/)
|
|
mobile?: string;
|
|
|
|
@IsOptional()
|
|
@IsEnum(UserRole)
|
|
role?: UserRole;
|
|
|
|
@IsOptional()
|
|
@ValidateIf((_, value) => value !== null)
|
|
@IsString()
|
|
@IsUrl()
|
|
avatarUrl?: string | null;
|
|
}
|