-
Notifications
You must be signed in to change notification settings - Fork 3
feat : s3 문제 수정, 삭제 기능 ( + 이미지 기능 포함 로직 추가 ) #115
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
Conversation
|
""" Walkthrough문제 수정 시 이미지 파일을 교체하거나 삭제할 수 있도록 S3 이미지 삭제 기능이 추가되었습니다. 컨트롤러, 서비스, S3 업로더, 예외 코드, 엔티티에 필요한 메서드 및 파라미터가 도입되었으며, 일부 DTO 주석이 보완되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant Admin as Admin Client
participant Controller as ProblemAdminController
participant Service as ProblemService
participant S3 as S3Uploader
participant Problem as Problem Entity
Admin->>Controller: PUT /problems/{id} (multipart/form-data: request + image)
Controller->>Service: modifyProblem(problemId, request, image)
alt 이미지가 첨부됨
Service->>S3: delete(oldImageUrl)
S3-->>Service: 삭제 성공/실패
Service->>S3: upload(newImage)
S3-->>Service: newImageUrl
Service->>Problem: clearImages()
Service->>Problem: addImage(newImageUrl)
end
Service-->>Controller: 완료
Controller-->>Admin: 200 OK
Possibly related PRs
Suggested reviewers
Poem
""" 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/main/java/org/ezcode/codetest/application/problem/dto/request/ProblemCreateRequest.java(1 hunks)src/main/java/org/ezcode/codetest/application/problem/dto/request/ProblemUpdateRequest.java(1 hunks)src/main/java/org/ezcode/codetest/application/problem/service/ProblemService.java(5 hunks)src/main/java/org/ezcode/codetest/domain/problem/model/entity/Problem.java(1 hunks)src/main/java/org/ezcode/codetest/infrastructure/s3/S3Uploader.java(2 hunks)src/main/java/org/ezcode/codetest/infrastructure/s3/exception/code/S3ExceptionCode.java(1 hunks)src/main/java/org/ezcode/codetest/presentation/problemmanagement/problem/ProblemAdminController.java(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: chat26666
PR: ezcode-my/backend#37
File: src/main/java/org/ezcode/codetest/infrastructure/elasticsearch/repository/ProblemElasticsearchRepositoryDsl.java:10-10
Timestamp: 2025-06-06T19:56:27.759Z
Learning: When user chat26666 mentions that code was implemented in a previous PR but explanation was missing, they may submit a follow-up PR just to add documentation/explanation without the actual implementation code.
src/main/java/org/ezcode/codetest/application/problem/dto/request/ProblemCreateRequest.java (1)
Learnt from: Kimminu7
PR: ezcode-my/backend#63
File: src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/ProblemQueryRepositoryImpl.java:24-40
Timestamp: 2025-06-14T14:33:58.372Z
Learning: ProblemController에서 ProblemSearchCondition 객체는 항상 new ProblemSearchCondition(category, difficulty)로 유효한 인스턴스를 생성해서 전달하므로, ProblemQueryRepositoryImpl의 searchByCondition 메서드에서 searchCondition 파라미터 자체에 대한 null 체크는 불필요하다. category와 difficulty 필드만 각각 null일 수 있다.
src/main/java/org/ezcode/codetest/application/problem/service/ProblemService.java (3)
Learnt from: Kimminu7
PR: ezcode-my/backend#63
File: src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/ProblemQueryRepositoryImpl.java:24-40
Timestamp: 2025-06-14T14:33:58.372Z
Learning: ProblemController에서 ProblemSearchCondition 객체는 항상 new ProblemSearchCondition(category, difficulty)로 유효한 인스턴스를 생성해서 전달하므로, ProblemQueryRepositoryImpl의 searchByCondition 메서드에서 searchCondition 파라미터 자체에 대한 null 체크는 불필요하다. category와 difficulty 필드만 각각 null일 수 있다.
Learnt from: chat26666
PR: ezcode-my/backend#31
File: src/main/java/org/ezcode/codetest/domain/problem/model/entity/ProblemSearchDocument.java:49-56
Timestamp: 2025-06-05T00:52:54.460Z
Learning: ProblemSearchDocument.from() 메서드는 트랜잭션 내에서 DB에서 실제로 조회한 Problem 엔티티만 사용하므로 null 체크가 불필요함. 이 컨텍스트에서는 null Problem이 있을 경우 이미 이전 단계에서 예외가 발생함.
Learnt from: chat26666
PR: ezcode-my/backend#31
File: src/main/java/org/ezcode/codetest/domain/problem/service/ProblemDomainService.java:25-27
Timestamp: 2025-06-04T15:11:19.343Z
Learning: In ProblemDomainService, when saving problems to both database and Elasticsearch, maintain transactional consistency by allowing rollback if either save operation fails. Data integrity between DB and ES is prioritized over availability - if Elasticsearch save fails, the entire transaction should roll back to prevent data inconsistency.
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
🔇 Additional comments (11)
src/main/java/org/ezcode/codetest/infrastructure/s3/S3Uploader.java (1)
29-29: 주석 추가 확인됨이미지 업로드 메소드에 주석이 추가되어 코드 가독성이 향상되었습니다.
src/main/java/org/ezcode/codetest/application/problem/dto/request/ProblemUpdateRequest.java (1)
14-14: API 문서화 개선categories 필드가 리스트라는 것을 명확히 하는 주석이 추가되어 API 사용성이 향상되었습니다.
src/main/java/org/ezcode/codetest/application/problem/dto/request/ProblemCreateRequest.java (1)
16-16: 일관된 API 문서화categories 필드가 Map이라는 것을 명확히 하는 주석이 추가되어 ProblemUpdateRequest와 일관된 문서화가 이루어졌습니다.
src/main/java/org/ezcode/codetest/infrastructure/s3/exception/code/S3ExceptionCode.java (1)
15-15: S3 삭제 실패 예외 코드 추가이미지 삭제 기능을 위한 새로운 예외 코드가 적절한 HTTP 상태코드와 메시지로 추가되었습니다.
src/main/java/org/ezcode/codetest/domain/problem/model/entity/Problem.java (1)
162-162: 포맷팅 개선incrementCorrectSubmissions() 메소드의 닫는 중괄호 위치가 정리되어 코드 일관성이 향상되었습니다.
src/main/java/org/ezcode/codetest/application/problem/service/ProblemService.java (3)
49-49: 포맷팅 개선이 적절합니다.불필요한 공백이 제거되어 코드 가독성이 향상되었습니다.
105-105: 메서드 시그니처 업데이트가 적절합니다.새로운 이미지 처리를 위한
MultipartFile newImage파라미터 추가가 올바르며, 컨트롤러 변경사항과 일치합니다.
119-122: 이미지 수정 로직이 안전하게 구현되었습니다.null 체크와 isEmpty 체크를 통해 안전성을 확보했고, 별도 메서드로 로직을 분리하여 코드 가독성이 향상되었습니다.
src/main/java/org/ezcode/codetest/presentation/problemmanagement/problem/ProblemAdminController.java (3)
50-50: 멀티파트 폼 데이터 지원이 적절히 추가되었습니다.이미지 업로드를 위한 멀티파트 폼 데이터 지원이 올바르게 구현되었습니다.
55-56: 파라미터 어노테이션 변경이 올바릅니다.
@RequestBody에서@RequestPart로 변경하고 선택적 이미지 파라미터를 추가한 것이 멀티파트 요청 처리에 적합합니다.
58-58: 서비스 호출이 업데이트된 시그니처와 일치합니다.새로운 이미지 파라미터를 포함한 서비스 메서드 호출이 올바르게 수정되었습니다.
작업 내용
변경 사항
트러블 슈팅
해결해야 할 문제
참고 사항
코드 리뷰 전 확인 체크리스트
type :)Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Documentation