feat(user): implement user profile management functionality

- Add user nickname update endpoint with validation
- Introduce user profile update endpoint supporting nickname and password changes
- Create UserProfileResponse DTO with nickname field
- Add SetUserNicknameRequest DTO for nickname updates
- Implement UserProfileUpdateRequest DTO for profile modifications
- Refactor UserService to UserProfileService with enhanced capabilities
- Update UserMapper to include nickname in result mapping
- Add new error codes for nickname and profile update failures
- Modify CORS configuration to allow requests from localhost:5173
- Remove obsolete AppConfig RestTemplate bean definition
- Rename UserinfoResponse to UserProfileResponse for consistency
- Adjust controller endpoints to use updated service and DTOs
- Add transactional support for user profile updates
- Improve error handling for user-related operations
This commit is contained in:
Chaos
2025-11-21 17:14:50 +08:00
parent d4bbaf6715
commit b2c6cfe90a
11 changed files with 219 additions and 99 deletions

View File

@@ -30,6 +30,9 @@ public enum ErrorCode {
PHONE_EXISTS(409, "USER-109", "手机号已注册"),
PHONE_FORMAT_ERROR(400, "USER-110", "手机号格式无效"),
USER_UPDATE_USERNAME_FAILED(400,"USER-111" , "用户名更新失败"),
USER_UPDATE_NICKNAME_FAILED( 400, "USER-112", "用户昵称更新失败" ),
USER_UPDATE_PROFILE_FAILED(400,"USER-113" , "用户信息更新失败" ),
// 用户组
ROLE_REVOKE_FAILED(400,"USER-112" ,"用户组删除失败" ),
@@ -58,10 +61,7 @@ public enum ErrorCode {
DEVICE_DELETE_FAILED(500, "DEVICE-303", "设备删除失败"),
DEVICE_TYPE_DELETE_FAILED(500, "DEVICE-304", "设备类型删除失败"),
DEVICE_TYPE_NOT_EMPTY(400, "DEVICE-305", "设备类型不为空"),
DEVICE_DISABLED(403, "DEVICE-306", "设备已禁用"),
;
DEVICE_DISABLED(403, "DEVICE-306", "设备已禁用");
private final int httpStatus;
private final String code; // 业务错误码(领域-编号)