Files
grow-api/src/users/dto/update-user.dto.ts
T
2026-07-10 13:50:25 +03:30

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;
}