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

@@ -0,0 +1,11 @@
package cn.nopj.chaos_api.dto.request;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
@Data
public class SetUserNicknameRequest {
@NotBlank(message = "昵称不能为空")
private String nickname;
}

View File

@@ -0,0 +1,9 @@
package cn.nopj.chaos_api.dto.request;
import lombok.Data;
@Data
public class UserProfileUpdateRequest {
private String nickname;
private String password;
}

View File

@@ -5,8 +5,9 @@ import lombok.Data;
import java.util.List;
@Data
public class UserinfoResponse {
public class UserProfileResponse {
private Long id;
private String username;
private String nickname;
private List<RoleResponse> roles;
}