-
Notifications
You must be signed in to change notification settings - Fork 1
[refactor] 유저 저장 장소 목록 조회 관련 리팩토링 #57
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
Changes from 3 commits
5a516a1
6a08c02
f6de6f9
247efc7
daf042b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,4 +57,13 @@ public class WaybleZone extends BaseEntity { | |
|
|
||
| @OneToMany(mappedBy = "waybleZone", cascade = CascadeType.ALL, orphanRemoval = true) | ||
| private List<UserPlaceWaybleZoneMapping> userPlaceMappings = new ArrayList<>(); | ||
|
|
||
| // 대표 이미지 필드 추가 | ||
| @Column(name = "main_image_url") | ||
| private String mainImageUrl; | ||
|
Comment on lines
+61
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainN+1 쿼리 문제 해결을 위한 좋은 접근입니다. 대표 이미지 URL을 별도 필드로 저장하여 스트림 연산을 통한 반복적인 이미지 조회를 방지하는 것은 성능 최적화에 효과적입니다. 데이터 정합성 유지를 위해 이미지 업데이트 시 mainImageUrl도 함께 업데이트되는 로직이 구현되어 있는지 확인해보세요. 이미지 업데이트 로직에서 mainImageUrl 동기화가 제대로 구현되어 있는지 확인해보겠습니다: 🏁 Script executed: #!/bin/bash
# Description: mainImageUrl 필드를 업데이트하는 로직이 있는지 확인
# WaybleZoneImage 관련 서비스에서 mainImageUrl 업데이트 로직 찾기
rg -A 10 "setMainImageUrl|mainImageUrl" --type java
# 이미지 업로드/수정 관련 코드에서 mainImageUrl 처리 확인
ast-grep --pattern 'setMainImageUrl($$$)'Length of output: 724 mainImageUrl 동기화 로직 구현 검토 필요 현재
예시: // 이미지 저장 후 대표 이미지 URL 동기화
WaybleZone zone = waybleZoneRepository.findById(zoneId)
.orElseThrow(...);
zone.setMainImageUrl(savedImage.getUrl());
waybleZoneRepository.save(zone);🤖 Prompt for AI Agents
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 나중에 사용할수도 있어서 일단 정의 해놓은거라 뺄수도 있고 로직을 더 추가할 수도 있어서 우선 로직을 더 추가하게 된다면 그때 직접 구현할게 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @seung-in-Yoo 네, 충분히 이해됩니다! 현재 단계에서는 구조만 정의해두고 나중에 필요에 따라 구현하거나 제거하는 것이 합리적인 접근 방식입니다. 향후
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오 code rabbit이랑 대화도 가능하군요...! ㅋㅋㅋㅋㅋㅋㅋㅋㅋ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| // 혹시 필요할수도 있어서 추가해놓음 | ||
| public void setMainImageUrl(String mainImageUrl) { | ||
| this.mainImageUrl = mainImageUrl; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
🛠️ Refactor suggestion
사용하지 않는 Authorization 헤더 파라미터를 제거하세요.
SecurityContextHolder를 사용하게 되면서 Authorization 헤더를 직접 파싱하지 않으므로, 해당 파라미터는 더 이상 필요하지 않습니다. JWT 필터에서 이미 처리되었기 때문입니다.
public CommonResponse<String> saveUserPlace( @PathVariable Long userId, - @RequestBody @Valid UserPlaceRequestDto request, - @RequestHeader(value = "Authorization") String authorizationHeader + @RequestBody @Valid UserPlaceRequestDto request ) {Also applies to: 62-62
🤖 Prompt for AI Agents
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.
code rabbit 말대로 Authorization 헤더는 빼는게 좋을 것 같네요!!!
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.
@KiSeungMin 알겠습니다! Authorization 헤더 파라미터와 관련된 잔여 코드(메서드 파라미터 및 불필요한 import) 제거 계획을 아래와 같이 잡았습니다.
• UserPlaceController에서 Authorization 헤더 파라미터 삭제 및 불필요한 import 정리
</plan_code_changes>
⏳ Preparing changes...
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.
A summary of the changes CodeRabbit can apply: