Skip to content

Conversation

@minjee2758
Copy link
Collaborator

@minjee2758 minjee2758 commented Jan 3, 2026

PR 생성 시 아래 항목을 채워주세요.

제목 예시: feat : Pull request template 작성

(작성 후 이 안내 문구는 삭제해주세요)


작업 내용

  • 어떤 기능(또는 수정 사항)을 구현했는지 간략하게 설명해주세요.
  • 예) "회원가입 API에 이메일 중복 검사 기능 추가"

변경 사항

  • 구현한 주요 로직, 클래스, 메서드 등을 bullet 형식으로 기술해주세요.
  • 예)
    • UserService.createUser() 메서드 추가
    • @Email 유효성 검증 적용

트러블 슈팅

  • 구현 중 마주한 문제와 해결 방법을 기술해주세요.
  • 예)
    • 문제: @Transactional이 적용되지 않음
    • 해결: 메서드 호출 방식 변경 (this.AopProxyUtils. 사용)

해결해야 할 문제

  • 기능은 동작하지만 리팩토링이나 논의가 필요한 부분을 적어주세요.
  • 예)D
    • UserController에서 비즈니스 로직 일부 처리 → 서비스로 이전 고려 필요

참고 사항

  • 기타 공유하고 싶은 정보나 참고한 문서(링크 등)가 있다면 작성해주세요.

코드 리뷰 전 확인 체크리스트

  • 불필요한 콘솔 로그, 주석 제거
  • 커밋 메시지 컨벤션 준수 (type : )
  • 기능 정상 동작 확인

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 이미지 정보에서 자동으로 파일명 추출 및 표시 기능 추가
  • 개선사항

    • 이미지 업로드 프로세스 개선: 새로운 이미지 업로드 시 기존 이미지가 자동으로 삭제되고 새 이미지가 적용됩니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 3, 2026

개요

이 PR은 ProblemDetailResponse DTO에 이미지 파일명을 추출하는 필드와 헬퍼 메서드를 추가하고, ProblemService의 이미지 업데이트 로직을 재정렬하여 새 이미지 업로드 전에 기존 이미지를 먼저 삭제하도록 수정합니다.

변경사항

응집 / 파일(들) 변경 요약
ProblemDetailResponse DTO 확장
src/main/java/org/ezcode/codetest/application/problem/dto/response/ProblemDetailResponse.java
imageName 필드 추가 및 extractFileName() 헬퍼 메서드 도입. 이미지 URL에서 파일명을 추출하며, null/공백 입력 처리 포함. from() 메서드는 imageUrl을 한 번만 계산하여 재사용하고 imageName 설정
ProblemService 이미지 삭제 로직 재정렬
src/main/java/org/ezcode/codetest/application/problem/service/ProblemService.java
addImageToExistingProblem 메서드에서 새 이미지 업로드 전에 기존 S3 이미지를 삭제하고 문제의 이미지 목록을 초기화하는 단계 순서 변경. 주석의 단계 번호 업데이트(1-3 → 1-2-3-4)

예상 코드 리뷰 노력

🎯 2 (Simple) | ⏱️ ~12분

관련 가능 PR

제안 레이블

bug

제안 검토자

  • NCookies
  • chat26666
  • pokerbearkr
  • thezz9

토끼의 축시

🐰 이미지 이름을 뽑아내고,
예전 사진은 먼저 삭제하네!
깔끔한 흐름으로 새것을 올리면,
문제는 더욱 멋져진다고! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경사항의 핵심 내용과 명확하게 일치합니다. 이미지 수정 기능 문제를 해결하는 것이 주요 변경사항입니다.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/main/java/org/ezcode/codetest/application/problem/service/ProblemService.java (1)

176-189: addImageToExistingProblem과의 일관성을 위해 명시적 저장을 추가하세요.

addImageToExistingProblem 메서드(Line 214)와 달리, 이 메서드는 새 이미지를 추가한 후(Line 188) 명시적으로 저장하지 않습니다. @Transactional 경계에서 자동으로 반영되더라도, 명시적 저장을 추가하면 코드의 의도가 명확해지고 두 메서드 간의 일관성이 유지됩니다.

🔎 제안하는 수정사항
 	private void updateProblemImage(Problem problem, MultipartFile newImage) {
 
 		// 기존 이미지가 있다면 삭제 처리
 		if (!problem.getImageUrl().isEmpty()) {
 			for(String fileUrl : problem.getImageUrl()) {
 				s3Uploader.delete(fileUrl, "problem");
 			}
 			problem.clearImages();
 			problemDomainService.saveProblem(problem);
 		}
 
 		String newImageUrl = uploadImageAfterTransaction(newImage, problem.getId());
 		problem.addImage(newImageUrl);
+		problemDomainService.saveProblem(problem);
 	}
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce9d1fe and 0ac9c92.

📒 Files selected for processing (2)
  • src/main/java/org/ezcode/codetest/application/problem/dto/response/ProblemDetailResponse.java
  • src/main/java/org/ezcode/codetest/application/problem/service/ProblemService.java
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-02T12:05:54.917Z
Learnt from: Kimminu7
Repo: ezcode-my/backend PR: 133
File: src/test/java/org/ezcode/codetest/domain/problem/service/ProblemDomainServiceTest.java:92-99
Timestamp: 2025-07-02T12:05:54.917Z
Learning: ProblemDomainService의 removeProblem 메서드는 DB에서 Problem을 삭제한 후 Elasticsearch에서도 해당 ProblemSearchDocument를 찾아서 삭제합니다. 만약 Elasticsearch에서 문서를 찾지 못하면 ProblemException(PROBLEM_NOT_FOUND)을 던지므로, 테스트에서는 problem.getId()와 searchRepository.findById() 모두 적절하게 mock해야 합니다.

Applied to files:

  • src/main/java/org/ezcode/codetest/application/problem/service/ProblemService.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (3)
src/main/java/org/ezcode/codetest/application/problem/service/ProblemService.java (1)

199-214: 이미지 수정 로직이 올바르게 구현되었습니다.

기존 이미지 삭제 → 새 이미지 업로드 → 문제에 연결 → 저장의 흐름이 명확하게 구현되어 있으며, 마지막에 명시적으로 saveProblem을 호출하여 변경사항이 DB에 반영되도록 보장합니다.

src/main/java/org/ezcode/codetest/application/problem/dto/response/ProblemDetailResponse.java (2)

56-57: 새로운 imageName 필드가 적절하게 추가되었습니다.

클라이언트에서 파일명을 직접 사용할 수 있도록 하는 유용한 필드입니다.


84-90: 이 주석은 이 프로젝트에 적용되지 않습니다.

S3Uploader.upload() 메서드는 amazonS3.getUrl(bucket, fileName).toString()을 사용하여 표준 S3 URL을 반환합니다. 이는 서명된 URL이 아니며 쿼리 파라미터를 포함하지 않습니다. 따라서 extractFileName 메서드는 현재 프로젝트에서 사용되는 URL 형식을 올바르게 처리합니다.

@minjee2758 minjee2758 merged commit 08f1926 into dev Jan 3, 2026
2 checks passed
@minjee2758 minjee2758 deleted the refactor/problem-category-get branch January 3, 2026 09:00
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