Skip to content

Commit

Permalink
[#32] Fix: isImageChange 자료형 Integer로 변경 및 테스트 성공
Browse files Browse the repository at this point in the history
  • Loading branch information
tkguswls1106 committed May 17, 2024
1 parent 17d46c4 commit 386fe4b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ public class SignupRequestDto {

private String nickname;
private String bojId;
private boolean isImageChange; // true : 새 사진으로 변경하는 경우. false : 기본사진으로 변경하는 경우.
private Integer isImageChange; // 1 : 새 사진으로 변경하는 경우. 0 : 기본사진으로 변경하는 경우.
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class MessageItem {
public static final String DELETE_USER = "SUCCESS - 회원 탈퇴 성공";

public static final String NOT_FOUND_USER = "ERROR - 존재하지 않는 회원 조회 에러";
public static final String NOT_FOUND_BOJID = "ERROR - 존재하지 않는 백준id 조회 에러"; // 404 에러 처리.
public static final String NOT_FOUND_BOJID = "ERROR - solvedac에 존재하지 않는 백준id 에러"; // 404 에러 처리.
public static final String BAD_REQUEST_USER = "ERROR - 잘못된 회원 요청 에러";
public static final String DUPLICATE_BOJID = "ERROR - 백준id 중복 에러"; // 400 에러 처리.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public class AuthServiceImpl implements AuthService {
public SignupResponseDto signup(MultipartFile imageFile, SignupRequestDto signupRequestDto) throws IOException {

// - 사진 변경X : if 'imageFile == null' --> AWS S3 업로드X
// - 사진 변경O : if 'imageFile != null && signupRequestDto.isImageChange() == true' --> AWS S3 업로드O
// - 기본사진으로 변경O : if 'imageFile != null && signupRequestDto.isImageChange() == false' --> AWS S3 업로드X & User imageUrl값 null로 업데이트
// - 사진 변경O : if 'imageFile != null && signupRequestDto.getIsImageChange() == 1' --> AWS S3 업로드O
// - 기본사진으로 변경O : if 'imageFile != null && signupRequestDto.getIsImageChange() == 0' --> AWS S3 업로드X & User imageUrl값 null로 업데이트

if(userRepository.existsByBojId(signupRequestDto.getBojId()) == true) { // 이미 해당 백준id로 가입한 사용자가 존재하는경우, 예외 처리.
throw new BojIdDuplicateException(signupRequestDto.getBojId());
Expand All @@ -55,11 +55,11 @@ public SignupResponseDto signup(MultipartFile imageFile, SignupRequestDto signup
}

// 새 프로필 사진을 AWS S3에 업로드 후, 이미지 url 반환.
if(imageFile != null && signupRequestDto.isImageChange() == true) { // 사진 변경O 경우
if(imageFile != null && signupRequestDto.getIsImageChange() == 1) { // 사진 변경O 경우
String uploadImageUrl = awsS3Service.uploadImage(imageFile);
user.updateImage(uploadImageUrl); // 새로운 사진 url로 imageUrl 업데이트.
}
else if(imageFile != null && signupRequestDto.isImageChange() == true) { // 기본사진으로 변경O
else if(imageFile != null && signupRequestDto.getIsImageChange() == 0) { // 기본사진으로 변경O
user.updateImage(null); // 기본사진임을 명시하고자 null값으로 imageUrl 업데이트.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static SolvedResponseDto getSolvedCount(String bojId){ // WebClient로
.bodyToMono(SolvedResponseDto.class)
.block();
}catch (Exception e){
throw new NoSuchBojIdException(bojId); // solvedac 서버에 존재하지않는 백준id일경우 예외 처리.
throw new NoSuchBojIdException("bojId = " + bojId); // solvedac 서버에 존재하지않는 백준id일경우 예외 처리.
}
}
}

0 comments on commit 386fe4b

Please sign in to comment.