Skip to content

Commit

Permalink
[feat] #22 프로필 사진 변경 service 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
ziiyouth committed Jan 5, 2024
1 parent 44274b9 commit a460bf8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@ public void setPassword(String newPassword) {
public void setCheckList(CheckList checkList) {
this.checkList = checkList;
}

public void setProfile(String profile){
this.profile = profile;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ private Long createMember(MemberSignUpRequestDto memberSignUpRequestDto) {
return userRepository.save(newUser).getId();
}

public void changeProfileImg(Long userId, ProfileImgRequestDto profileImgRequestDto){
User user = findByIdOrThrow(userId);
String imageUrl = switch (profileImgRequestDto.profileImageType()) {
case PROFILE_1 -> ProfileImageType.PROFILE_1.getImageUrl();
case PROFILE_2 -> ProfileImageType.PROFILE_2.getImageUrl();
case PROFILE_3 -> ProfileImageType.PROFILE_3.getImageUrl();
};
user.setProfile(imageUrl);
userRepository.save(user);
}

private String encodedPassword(String rawPassword) {
return passwordEncoder.encode(rawPassword);
}
Expand Down

0 comments on commit a460bf8

Please sign in to comment.