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

탈퇴 기능, 유저 state enum 추가 #5

Merged
merged 3 commits into from
Sep 27, 2024
Merged

Conversation

5upportPark
Copy link
Collaborator

No description provided.

@@ -52,4 +52,11 @@ public ResponseEntity<RegistUserResponse> registUser(@RequestBody @Valid RegistU

return new ResponseEntity<RegistUserResponse>(response, httpStatus);
}

@PostMapping("/withdraw")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DelteMapping 쓰시는게


@Override
public UserState convertToEntityAttribute(Integer code) {
if(code == null) return null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null 보다는 default를 넣는게 낫지 않을까

}

public static UserState getValue(int code) {
return Arrays.stream(UserState.values()).filter(state -> state.getCode() == code).findFirst().orElse(null);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good~

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null보다는 default 만들기~

public void withdrawUser(String loginId) {
User user = userRepository.findByLoginId(loginId).orElseThrow(UserNotFoundException::new);
user.setState(UserState.WITHDRAW);
user.setName(null);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user.withdraw() 안에서 다 해버리기~

@5upportPark 5upportPark merged commit fc33b0a into dev Sep 27, 2024
1 check passed
@5upportPark 5upportPark deleted the feature/withdraw_user branch September 27, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants