Implement user profile update with fullName, avatarUrl, and email fields. Email changes include uniqueness validation and Email VO verification. Follows existing DDD/CQRS patterns with cache invalidation. 19 unit tests covering handler logic and DTO validation. Co-Authored-By: Paperclip <noreply@paperclip.ing>
25 lines
725 B
TypeScript
25 lines
725 B
TypeScript
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { IsEmail, IsOptional, IsString, IsUrl, MinLength } from 'class-validator';
|
|
|
|
export class UpdateProfileDto {
|
|
@ApiPropertyOptional({ example: 'Nguyen Van A', description: 'Full name' })
|
|
@IsOptional()
|
|
@IsString()
|
|
@MinLength(1)
|
|
fullName?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
example: 'https://cdn.goodgo.vn/avatars/user-123.jpg',
|
|
description: 'Avatar URL',
|
|
})
|
|
@IsOptional()
|
|
@IsString()
|
|
@IsUrl({}, { message: 'Avatar URL không hợp lệ' })
|
|
avatarUrl?: string;
|
|
|
|
@ApiPropertyOptional({ example: 'user@example.com', description: 'Email address' })
|
|
@IsOptional()
|
|
@IsEmail({}, { message: 'Email không hợp lệ' })
|
|
email?: string;
|
|
}
|