feat(auth): add PATCH /auth/profile endpoint for user profile updates
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>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user