-
Notifications
You must be signed in to change notification settings - Fork 3
[MERGE] dev -> main #409
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
[MERGE] dev -> main #409
Changes from all commits
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 |
|---|---|---|
|
|
@@ -18,8 +18,7 @@ public class FeedCommentConverter { | |
| public FeedCommentResponseDto.AllFeedCommentDto toAllFeedCommentDto(FeedCommentDto.FeedCommentInfoDto dto, Long currentUserId) { | ||
| return FeedCommentResponseDto.AllFeedCommentDto.builder() | ||
| .userId(dto.getUserId()) | ||
| .userName(dto.getUserName() + " " + dto.getRole().getVegetable()) | ||
| .role(dto.getRole()) | ||
| .userName(dto.getUserName() + " 새싹") | ||
|
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. 🛠️ Refactor suggestion " 새싹" 접미사 하드코딩 중복 — 공통 유틸 사용으로 일원화 권장 Notification/Pot/Feed 컨버터 전반에 동일한 접미사가 반복됩니다. 공통 유틸(UserDisplayName)로 치환해 중복/국제화 이슈를 해소하세요. 치환 예시: - .userName(dto.getUserName() + " 새싹")
+ .userName(UserDisplayName.formatSeedling(dto.getUserName()))- .userName(userName + " 새싹")
+ .userName(UserDisplayName.formatSeedling(userName))- .userName(userName + " 새싹")
+ .userName(UserDisplayName.formatSeedling(userName))(별도 유틸 클래스는 NotificationConverter 코멘트를 참고하세요. import 추가 필요) Also applies to: 36-36, 49-49 🤖 Prompt for AI Agents |
||
| .isCommentWriter(Objects.equals(dto.getUserId(), currentUserId)) | ||
| .isFeedWriter(Objects.equals(dto.getFeedWriterId(), dto.getUserId())) | ||
| .commentId(dto.getCommentId()) | ||
|
|
@@ -30,26 +29,24 @@ public FeedCommentResponseDto.AllFeedCommentDto toAllFeedCommentDto(FeedCommentD | |
| .build(); | ||
| } | ||
|
|
||
| public FeedCommentResponseDto.FeedCommentCreateDto toFeedCommentCreateDto(Long userId, String userName, Role role, Boolean isWriter, | ||
| public FeedCommentResponseDto.FeedCommentCreateDto toFeedCommentCreateDto(Long userId, String userName, Boolean isWriter, | ||
| Long commentId, String comment, LocalDateTime createdAt) { | ||
| return FeedCommentResponseDto.FeedCommentCreateDto.builder() | ||
| .userId(userId) | ||
| .userName(userName) | ||
| .role(role) | ||
| .userName(userName + " 새싹") | ||
| .isWriter(isWriter) | ||
| .commentId(commentId) | ||
| .comment(comment) | ||
| .createdAt(createdAt) | ||
| .build(); | ||
| } | ||
|
|
||
| public FeedCommentResponseDto.FeedReplyCommentCreateDto toFeedReplyCommentCreateDto(Long userId, String userName, Role role, Boolean isWriter, | ||
| public FeedCommentResponseDto.FeedReplyCommentCreateDto toFeedReplyCommentCreateDto(Long userId, String userName, Boolean isWriter, | ||
| Long commentId, String comment, Long parentCommentId, | ||
| LocalDateTime createdAt) { | ||
| return FeedCommentResponseDto.FeedReplyCommentCreateDto.builder() | ||
| .userId(userId) | ||
| .userName(userName) | ||
| .role(role) | ||
| .userName(userName + " 새싹") | ||
| .isWriter(isWriter) | ||
| .commentId(commentId) | ||
| .comment(comment) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,11 +14,12 @@ public interface FeedCommentRepository extends JpaRepository<FeedComment, Long> | |
| @Query("select fc from FeedComment fc where fc.id = :commentId") | ||
| Optional<FeedComment> findByCommentId(@Param("commentId") Long commentId); | ||
|
|
||
| @Query("select new stackpot.stackpot.feed.dto.FeedCommentInfoDto(fc.user.id, fc.user.nickname, fc.user.role, " + | ||
| @Query("select new stackpot.stackpot.feed.dto.FeedCommentDto$FeedCommentInfoDto(fc.user.id, fc.user.nickname, " + | ||
| "fc.feed.user.id, fc.id, fc.comment, fc.parent.id, fc.createdAt) " + | ||
| "from FeedComment fc where fc.feed.feedId = :feedId") | ||
| List<FeedCommentDto.FeedCommentInfoDto> findAllCommentInfoDtoByFeedId(@Param("feedId") Long feedId); | ||
|
Comment on lines
+17
to
20
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. 🛠️ Refactor suggestion fc.parent.id 사용으로 인한 암묵적 inner join — 상위 댓글이 누락됩니다 JPQL select 절에서 - @Query("select new stackpot.stackpot.feed.dto.FeedCommentDto$FeedCommentInfoDto(fc.user.id, fc.user.nickname, " +
- "fc.feed.user.id, fc.id, fc.comment, fc.parent.id, fc.createdAt) " +
- "from FeedComment fc where fc.feed.feedId = :feedId")
+ @Query("select new stackpot.stackpot.feed.dto.FeedCommentDto$FeedCommentInfoDto(fc.user.id, fc.user.nickname, " +
+ "fc.feed.user.id, fc.id, fc.comment, p.id, fc.createdAt) " +
+ "from FeedComment fc left join fc.parent p where fc.feed.feedId = :feedId")🤖 Prompt for AI Agents |
||
|
|
||
| @Query("SELECT COUNT(fc) FROM FeedComment fc WHERE fc.feed.feedId = :feedId") | ||
| Long countByFeedId(@Param("feedId") Long feedId); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -48,11 +48,11 @@ public FeedCommentResponseDto.FeedCommentCreateDto createFeedComment(FeedComment | |||||
| Boolean isWriter = Objects.equals(user.getId(), feed.getUser().getUserId()); | ||||||
|
|
||||||
| NotificationResponseDto.UnReadNotificationDto dto = notificationCommandService.createdFeedCommentNotification( | ||||||
| feedId, feedComment.getId(), user.getId(), user.getRole()); | ||||||
| feedId, feedComment.getId(), user.getId()); | ||||||
|
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 chain메서드 네이밍 일관성: createdFeedCommentNotification → createFeedCommentNotification 고려 Pot 쪽은 createPotCommentNotification, 여기만 createdFeedCommentNotification입니다. 네이밍을 create*로 일원화하면 API 일관성이 좋아집니다. 레포지토리 전역에서 두 네이밍의 혼재 여부를 확인하려면: 🏁 Script executed: #!/bin/bash
rg -n "createdFeedCommentNotification\(" -A 1
rg -n "createFeedCommentNotification\(" -A 1
rg -n "createPotCommentNotification\(" -A 1Length of output: 2337 메서드 네이밍 통일: Feed 쪽은
// NotificationCommandService.java
- public NotificationResponseDto.UnReadNotificationDto createdFeedCommentNotification(Long feedId, Long commentId, Long userId) {
+ public NotificationResponseDto.UnReadNotificationDto createFeedCommentNotification(Long feedId, Long commentId, Long userId) {
// …
}
// FeedCommentCommandService.java
- notificationCommandService.createdFeedCommentNotification(feedId, feedComment.getId(), user.getId());
+ notificationCommandService.createFeedCommentNotification(feedId, feedComment.getId(), user.getId());📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| applicationEventPublisher.publishEvent(new FeedCommentEvent(feed.getUser().getUserId(), null, dto)); | ||||||
|
|
||||||
| return feedCommentConverter.toFeedCommentCreateDto(user.getUserId(), user.getNickname(), user.getRole(), isWriter, | ||||||
| return feedCommentConverter.toFeedCommentCreateDto(user.getUserId(), user.getNickname(), isWriter, | ||||||
| feedComment.getId(), comment, feedComment.getCreatedAt()); | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -73,11 +73,11 @@ public FeedCommentResponseDto.FeedReplyCommentCreateDto createFeedReplyComment(L | |||||
| Boolean isWriter = Objects.equals(user.getId(), feed.getUser().getUserId()); | ||||||
|
|
||||||
| NotificationResponseDto.UnReadNotificationDto dto = notificationCommandService.createdFeedCommentNotification( | ||||||
| feedId, feedComment.getId(), user.getId(), user.getRole()); | ||||||
| feedId, feedComment.getId(), user.getId()); | ||||||
|
|
||||||
| applicationEventPublisher.publishEvent(new FeedCommentEvent(feed.getUser().getUserId(), parent.getUser().getUserId(), dto)); | ||||||
|
|
||||||
| return feedCommentConverter.toFeedReplyCommentCreateDto(user.getUserId(), user.getNickname(), user.getRole(), isWriter, | ||||||
| return feedCommentConverter.toFeedReplyCommentCreateDto(user.getUserId(), user.getNickname(), isWriter, | ||||||
| feedComment.getId(), comment, parent.getId(), feedComment.getCreatedAt()); | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,21 +18,19 @@ public NotificationResponseDto.UnReadNotificationDto toUnReadNotificationDto(Not | |
| return NotificationResponseDto.UnReadNotificationDto.builder() | ||
| .notificationId(unReadNotificationDto.getNotificationId()) | ||
| .potOrFeedId(unReadNotificationDto.getPotOrFeedId()) | ||
| .role(unReadNotificationDto.getRole()) | ||
| .userName(unReadNotificationDto.getUserName() + " " + unReadNotificationDto.getRole().getVegetable()) | ||
| .userName(unReadNotificationDto.getUserName() + " 새싹") | ||
|
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. 🛠️ Refactor suggestion 하드코딩된 " 새싹" 접미사 중복 — 공통 유틸로 추출 권장 여러 컨버터에서 동일한 접미사를 직접 더하고 있어 변경/국제화(i18n) 시 관리가 어렵습니다. 공통 유틸로 추출해 단일 책임으로 관리하세요. 적용 제안(해당 라인 치환): - .userName(unReadNotificationDto.getUserName() + " 새싹")
+ .userName(UserDisplayName.formatSeedling(unReadNotificationDto.getUserName()))- .userName(userName + " 새싹")
+ .userName(UserDisplayName.formatSeedling(userName))유틸 클래스 예시(새 파일): package stackpot.stackpot.common.util;
public final class UserDisplayName {
private static final String SEEDLING_SUFFIX = " 새싹";
private UserDisplayName() {}
public static String formatSeedling(String userName) {
return userName + SEEDLING_SUFFIX;
}
}각 파일 상단에 import 추가:
Also applies to: 33-33 🤖 Prompt for AI Agents |
||
| .type(unReadNotificationDto.getType()) | ||
| .content(unReadNotificationDto.getContent()) | ||
| .createdAt(unReadNotificationDto.getCreatedAt().format(DATE_FORMATTER)) | ||
| .build(); | ||
| } | ||
|
|
||
| public NotificationResponseDto.UnReadNotificationDto toUnReadNotificationDto( | ||
| Long notificationId, Long potOrFeedId, Role role, String userName, String type, String content, LocalDateTime createdAt) { | ||
| Long notificationId, Long potOrFeedId, String userName, String type, String content, LocalDateTime createdAt) { | ||
| return NotificationResponseDto.UnReadNotificationDto.builder() | ||
| .notificationId(notificationId) | ||
| .potOrFeedId(potOrFeedId) | ||
| .role(role) | ||
| .userName(userName + " " + role.getVegetable()) | ||
| .userName(userName + " 새싹") | ||
| .type(type) | ||
| .content(content) | ||
| .createdAt(createdAt.format(DATE_FORMATTER)) | ||
|
|
||
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.
💡 Verification agent
🧩 Analysis chain
getDefaultBadge → getBadge(badgeId) 전환 — 호출부 매직넘버 제거/캡슐화 권장
호출부에서 하드코딩된 ID(예: 1L/2L)를 넘기기보다, 상수/enum(BadgeType 등)로 캡슐화해 의미를 명확히 하세요. 또한
getDefaultBadge()사용처가 남아있지 않은지 확인 필요합니다.아래로 잔존
getDefaultBadge호출을 확인하세요.🏁 Script executed:
Length of output: 34
잔존하는
getDefaultBadge호출 혹은 정의가 완전히 제거됐는지 추가로 확인해 주세요.🏁 Script executed:
Length of output: 23
getDefaultBadge 호출 완전 제거 확인 및 매직넘버 사용 여부 추가 검증 필요
getDefaultBadge관련 호출·정의는 코드베이스 전반에서 모두 제거된 것을 확인했습니다.다음으로, 여전히
getBadge(1L/2L…)형태로 숫자 리터럴이 사용되고 있지 않은지 검증해 주세요.🏁 Script executed:
Length of output: 244
1L/2L 매직 넘버 상수·enum으로 캡슐화 필요
현재 여전히 하드코딩된 배지 ID를 직접 넘기고 있어 의미가 불명확합니다. 아래 위치를 상수 혹은
BadgeType등의 enum으로 대체해 가독성과 유지보수성을 높여주세요.• src/main/java/stackpot/stackpot/badge/service/BadgeServiceImpl.java:63
• src/main/java/stackpot/stackpot/badge/service/BadgeServiceImpl.java:86
예시 수정안:
또는 메서드 시그니처를
처럼 변경해 호출부에서
getBadge(BadgeType.DEFAULT)로 바로 사용하도록 리팩토링할 수도 있습니다.🤖 Prompt for AI Agents