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:
Ho Ngoc Hai
2026-04-15 22:34:40 +07:00
parent 8039b47795
commit 74c52198b3
9 changed files with 496 additions and 12 deletions

View File

@@ -138,4 +138,11 @@ export class UserEntity extends AggregateRoot<string> {
this._totpBackupCodes = this._totpBackupCodes.filter((_, i) => i !== index);
this.updatedAt = new Date();
}
updateProfile(fullName?: string, avatarUrl?: string | null, email?: Email | null): void {
if (fullName !== undefined) this._fullName = fullName;
if (avatarUrl !== undefined) this._avatarUrl = avatarUrl;
if (email !== undefined) this._email = email;
this.updatedAt = new Date();
}
}