Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor]: 유저 정보 수정 API 요청DTO, 응답DTO enum value로 변경 #93

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/main/java/com/onnoff/onnoff/domain/user/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ public void setUserStatusInactive(){
}

public void updateUser(UserRequestDTO.ModifyUserDTO modifyUserDTO) {
FieldOfWork fieldOfWork = FieldOfWork.fromValue(modifyUserDTO.getFieldOfWork());
ExperienceYear experienceYear = ExperienceYear.fromValue(modifyUserDTO.getExperienceYear());

this.nickname = modifyUserDTO.getNickname();
this.fieldOfWork = modifyUserDTO.getFieldOfWork();
this.job = modifyUserDTO.getJob();
this.experienceYear = modifyUserDTO.getExperienceYear();
this.fieldOfWork = fieldOfWork;
this.experienceYear = experienceYear;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public ApiResponse<UserResponseDTO.UserDetailDTO> withdrawUser(){

@PutMapping("/")
@Operation(summary = "회원 정보 수정 API" , description = "회원 정보 수정 API입니다.")
public ApiResponse<UserResponseDTO.UserDetailDTO> modifyUser(@RequestBody UserRequestDTO.ModifyUserDTO modifyUserDTO) {
return ApiResponse.onSuccess(UserConverter.toUserDetailDTO(userService.modifyUser(modifyUserDTO)));
public ApiResponse<UserResponseDTO.UserModificationResponseDTO> modifyUser(@RequestBody UserRequestDTO.ModifyUserDTO modifyUserDTO) {
return ApiResponse.onSuccess(UserConverter.toUserModificationResponseDTO(userService.modifyUser(modifyUserDTO)));
}

//테스트용
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,12 @@ public static UserResponseDTO.UserInformationResponseDTO toUserInformationRespon
.fieldOfWork(user.getFieldOfWork())
.build();
}

public static UserResponseDTO.UserModificationResponseDTO toUserModificationResponseDTO(User user){
return UserResponseDTO.UserModificationResponseDTO.builder()
.nickname(user.getNickname())
.experienceYear(user.getExperienceYear().getValue())
.fieldOfWork(user.getFieldOfWork().getValue())
.job(user.getJob())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public class UserRequestDTO {
@AllArgsConstructor
public static class ModifyUserDTO{
private String nickname;
private FieldOfWork fieldOfWork;
private String fieldOfWork;
private String job;
private ExperienceYear experienceYear;
private String experienceYear;
}

@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,14 @@ public static class UserInformationResponseDTO {
private FieldOfWork fieldOfWork;
private ExperienceYear experienceYear;
}

@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
public static class UserModificationResponseDTO {
private String nickname;
private String fieldOfWork;
private String experienceYear;
private String job;
}
}
Loading