Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,32 @@ public class PotBadgeMemberController {
@GetMapping("/pots/{pot_id}")
public ResponseEntity<ApiResponse<List<PotBadgeMemberDto>>> getBadgeMembersByPotId(
@PathVariable("pot_id") Long potId) {

List<PotBadgeMemberDto> badgeMembers = potBadgeMemberService.getBadgeMembersByPotId(potId);
return ResponseEntity.ok(ApiResponse.onSuccess(badgeMembers));
}

@Operation(summary = "팟에서 가장 많은 `투두를 완료한' 멤버에게 뱃지 부여")
@Operation(summary = "팟에서 가장 많은 `투두를 완료한' 멤버에게 '할 일 정복자' 뱃지 부여")
@PostMapping("/{potId}")
@ApiErrorCodeExamples({
ErrorStatus.BADGE_NOT_FOUND,
ErrorStatus.BADGE_INSUFFICIENT_TODO_COUNTS,
ErrorStatus.POT_MEMBER_NOT_FOUND
})
public ResponseEntity<ApiResponse<Void>> assignBadgeToTopMembers(
@PathVariable Long potId) {
public ResponseEntity<ApiResponse<Void>> assignBadgeToTopMembers(@PathVariable Long potId) {
badgeService.assignBadgeToTopMembers(potId);
return ResponseEntity.ok(ApiResponse.onSuccess(null));
}


@Operation(summary = "전체 프로젝트 업무 수 대비 개인이 담당한 업무 수 비율이 큰 사람에게 '없어서는 안 될 능력자' 뱃지 부여")
@PostMapping("/{potId}/task-badge")
@ApiErrorCodeExamples({
ErrorStatus.BADGE_NOT_FOUND,
ErrorStatus.BADGE_INSUFFICIENT_TOP_MEMBERS,
ErrorStatus.POT_MEMBER_NOT_FOUND
})
public ResponseEntity<ApiResponse<Void>> assignTaskBadgeToTopMembers(@PathVariable Long potId) {
badgeService.assignTaskBadgeToTopMembers(potId);
return ResponseEntity.ok(ApiResponse.onSuccess(null));
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public interface PotMemberBadgeRepository extends JpaRepository<PotMemberBadge,
@Query("DELETE FROM PotMemberBadge b WHERE b.potMember.potMemberId IN :potMemberIds")
void deleteByPotMemberIds(@Param("potMemberIds") List<Long> potMemberIds);


@Query("SELECT CASE WHEN count(b) > 0 THEN true ELSE false END FROM PotMemberBadge b WHERE b.potMember.potMemberId = :potMemberId AND b.badge.badgeId = :badgeId")
boolean existsByBadgeAndPotMember(@Param("potMemberId") Long potMemberId, @Param("badgeId") Long badgeId);
}

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import stackpot.stackpot.badge.entity.Badge;

public interface BadgeService {
Badge getDefaultBadge();
Badge getBadge(Long badgeId);
Copy link

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:

#!/bin/bash
rg -n -C1 $'getDefaultBadge\\s*\\('

Length of output: 34


잔존하는 getDefaultBadge 호출 혹은 정의가 완전히 제거됐는지 추가로 확인해 주세요.


🏁 Script executed:

#!/bin/bash
rg -n 'getDefaultBadge'

Length of output: 23


getDefaultBadge 호출 완전 제거 확인 및 매직넘버 사용 여부 추가 검증 필요

getDefaultBadge 관련 호출·정의는 코드베이스 전반에서 모두 제거된 것을 확인했습니다.
다음으로, 여전히 getBadge(1L/2L…) 형태로 숫자 리터럴이 사용되고 있지 않은지 검증해 주세요.


🏁 Script executed:

#!/bin/bash
rg -n 'getBadge\s*\(\s*\d+L'

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

예시 수정안:

- Badge badge = getBadge(1L);
+ Badge badge = getBadge(BadgeType.DEFAULT.getId());

- Badge badge = getBadge(2L);
+ Badge badge = getBadge(BadgeType.SPECIAL.getId());

또는 메서드 시그니처를

Badge getBadge(BadgeType type);

처럼 변경해 호출부에서 getBadge(BadgeType.DEFAULT)로 바로 사용하도록 리팩토링할 수도 있습니다.

🤖 Prompt for AI Agents
In src/main/java/stackpot/stackpot/badge/service/BadgeService.java around line 6
and in src/main/java/stackpot/stackpot/badge/service/BadgeServiceImpl.java at
lines 63 and 86, replace the hardcoded badge ID magic numbers (1L/2L) with a
clear encapsulation: add a BadgeType enum (e.g., DEFAULT, SPECIAL) or public
constants in BadgeService, update the method signature to Badge
getBadge(BadgeType type) (or keep getBadge(Long id) but use constants), change
the implementation to map BadgeType to the corresponding ID and update all
callers to pass BadgeType.DEFAULT / BadgeType.SPECIAL (or the new constants),
and remove any direct 1L/2L usages so that badge meanings are explicit and
maintainable.

void assignBadgeToTopMembers(Long potId);
void assignTaskBadgeToTopMembers(Long potId);
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import stackpot.stackpot.badge.repository.PotMemberBadgeRepository;
import stackpot.stackpot.pot.entity.mapping.PotMember;
import stackpot.stackpot.pot.repository.PotMemberRepository;
import stackpot.stackpot.task.service.TaskQueryService;
import stackpot.stackpot.todo.entity.enums.TodoStatus;
import stackpot.stackpot.todo.repository.UserTodoRepository;

Expand All @@ -29,12 +30,11 @@ public class BadgeServiceImpl implements BadgeService {
private final PotMemberRepository potMemberRepository;
private final PotMemberBadgeRepository potMemberBadgeRepository;
private final PotBadgeMemberConverter potBadgeMemberConverter;

private static final Long DEFAULT_BADGE_ID = 1L;
private final TaskQueryService taskQueryService;

@Override
public Badge getDefaultBadge() {
return badgeRepository.findBadgeByBadgeId(DEFAULT_BADGE_ID)
public Badge getBadge(Long badgeId) {
return badgeRepository.findBadgeByBadgeId(badgeId)
.orElseThrow(() -> new PotHandler(BADGE_NOT_FOUND));
}

Expand All @@ -57,10 +57,10 @@ public void assignBadgeToTopMembers(Long potId) {
List<PotMember> topPotMembers = topUserIds.stream()
.map(userId -> potMemberRepository.findByPot_PotIdAndUser_Id(potId, userId)
.orElseThrow(() -> new PotHandler(ErrorStatus.POT_MEMBER_NOT_FOUND)))
.collect(Collectors.toList());
.toList();

// 4. 기본 배지 부여
Badge badge = getDefaultBadge();
// 4. Todo 배지 부여
Badge badge = getBadge(1L);
for (PotMember potMember : topPotMembers) {
PotMemberBadge potMemberBadge = PotMemberBadge.builder()
.badge(badge)
Expand All @@ -69,5 +69,28 @@ public void assignBadgeToTopMembers(Long potId) {
potMemberBadgeRepository.save(potMemberBadge);
}
}

@Transactional
@Override
public void assignTaskBadgeToTopMembers(Long potId) {
List<Long> potMemberIds = potMemberRepository.selectPotMemberIdsByPotId(potId);
if (potMemberIds.isEmpty()) {
throw new PotHandler(ErrorStatus.POT_MEMBER_NOT_FOUND);
}

List<PotMember> top2PotMembers = taskQueryService.getTop2TaskCountByPotMemberId(potMemberIds);
if (top2PotMembers.size() < 2) {
throw new PotHandler(ErrorStatus.BADGE_INSUFFICIENT_TOP_MEMBERS);
}

Badge badge = getBadge(2L);
List<PotMemberBadge> newBadges = top2PotMembers.stream()
.filter(pm -> !potMemberBadgeRepository.existsByBadgeAndPotMember(pm.getPotMemberId(),badge.getBadgeId()))
.map(pm -> PotMemberBadge.builder().badge(badge).potMember(pm).build())
.collect(Collectors.toList());
if (!newBadges.isEmpty()) {
potMemberBadgeRepository.saveAll(newBadges);
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -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() + " 새싹")
Copy link

Choose a reason for hiding this comment

The 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
In src/main/java/stackpot/stackpot/feed/converter/FeedCommentConverter.java
around lines 21, 36 and 49, replace the hardcoded " 새싹" string concatenations
with a shared UserDisplayName utility call (e.g., a method that appends the
seedling suffix) and add the corresponding import; update each occurrence to
call the utility (instead of dto.getUserName() + " 새싹") so the suffix logic is
centralized and internationalization/duplication is avoided.

.isCommentWriter(Objects.equals(dto.getUserId(), currentUserId))
.isFeedWriter(Objects.equals(dto.getFeedWriterId(), dto.getUserId()))
.commentId(dto.getCommentId())
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class FeedCommentDto {
public static class FeedCommentInfoDto {
private Long userId;
private String userName;
private Role role;
private Long feedWriterId; // Feed 작성자
private Long commentId;
private String comment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
public class FeedCommentInfoDto {
private Long userId;
private String userName;
private Role role;
private Long feedWriterId;
private Long commentId;
private String comment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class FeedCommentResponseDto {
public static class AllFeedCommentDto {
private Long userId;
private String userName;
private Role role;
private Boolean isCommentWriter;
private Boolean isFeedWriter;
private Long commentId;
Expand All @@ -35,7 +34,6 @@ public static class AllFeedCommentDto {
public static class FeedCommentCreateDto {
private Long userId;
private String userName;
private Role role;
private Boolean isWriter;
private Long commentId;
private String comment;
Expand All @@ -49,7 +47,6 @@ public static class FeedCommentCreateDto {
public static class FeedReplyCommentCreateDto {
private Long userId;
private String userName;
private Role role;
private Boolean isWriter;
private Long commentId;
private String comment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

fc.parent.id 사용으로 인한 암묵적 inner join — 상위 댓글이 누락됩니다

JPQL select 절에서 fc.parent.id를 참조하면 암묵적 inner join이 발생하여 parent가 null인 상위 댓글(루트 댓글)이 결과에서 제외됩니다. left join으로 수정해 주세요.

-    @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
In src/main/java/stackpot/stackpot/feed/repository/FeedCommentRepository.java
around lines 17 to 20, the JPQL references fc.parent.id which causes an implicit
inner join and drops root comments with null parent; change the query to perform
an explicit LEFT JOIN on fc.parent (e.g., left join fc.parent p) and select p.id
(instead of fc.parent.id) so comments with null parent are included; update the
select expression to use the joined alias and keep the rest of the projection
and method signature unchanged.


@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
Expand Up @@ -211,7 +211,7 @@ public boolean toggleLike(Long feedId) {
FeedLike savedFeedLike = feedLikeRepository.save(feedLike);

NotificationResponseDto.UnReadNotificationDto dto = notificationCommandService.createFeedLikeNotification(
feed.getFeedId(), savedFeedLike.getLikeId(), user.getId(), user.getRole());
feed.getFeedId(), savedFeedLike.getLikeId(), user.getId());

applicationEventPublisher.publishEvent(new FeedLikeEvent(feed.getUser().getUserId(), dto));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Copy link

Choose a reason for hiding this comment

The 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 1

Length of output: 2337


메서드 네이밍 통일: createdFeedCommentNotificationcreateFeedCommentNotification

Feed 쪽은 createdFeedCommentNotification, Pot 쪽은 createPotCommentNotification을 사용 중이라 네이밍 스타일이 일관되지 않습니다. 두 기능 모두 create* 형태로 통일해 API 일관성을 높여주세요.

  • 변경 대상 파일 및 위치
    • src/main/java/stackpot/stackpot/notification/service/NotificationCommandService.java (124~125행): 메서드 선언부
    • src/main/java/stackpot/stackpot/feed/service/FeedCommentCommandService.java (5051, 7576행): 호출부
// 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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
feedId, feedComment.getId(), user.getId());
notificationCommandService.createFeedCommentNotification(feedId, feedComment.getId(), user.getId());
🤖 Prompt for AI Agents
In
src/main/java/stackpot/stackpot/notification/service/NotificationCommandService.java
around lines 124-125 and in
src/main/java/stackpot/stackpot/feed/service/FeedCommentCommandService.java
around lines 50-51 and 75-76, the notification method is inconsistently named
`createdFeedCommentNotification`; rename the method declaration to
`createFeedCommentNotification` and update all call sites in
FeedCommentCommandService to call `createFeedCommentNotification` instead of
`createdFeedCommentNotification`; ensure method signature, visibility and
imports remain unchanged and run a build to fix any remaining references.


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());
}

Expand All @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() + " 새싹")
Copy link

Choose a reason for hiding this comment

The 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 추가:

  • import stackpot.stackpot.common.util.UserDisplayName;

Also applies to: 33-33

🤖 Prompt for AI Agents
In
src/main/java/stackpot/stackpot/notification/converter/NotificationConverter.java
around lines 21 and 33, multiple places concatenate the hardcoded suffix " 새싹"
to user names; extract this into a single utility to avoid duplication and ease
future i18n/changes. Create a new util class (e.g.,
stackpot.stackpot.common.util.UserDisplayName) with a private constant for the
suffix and a public static method formatSeedling(String userName) that returns
userName + SUFFIX, add the import in NotificationConverter, and replace both
occurrences of userName + " 새싹" with UserDisplayName.formatSeedling(userName).

.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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class NotificationDto {
public static class UnReadNotificationDto {
private Long notificationId;
private Long potOrFeedId;
private Role role;
private String userName;
private String type;
private String content;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class NotificationResponseDto {
public static class UnReadNotificationDto {
private Long notificationId;
private Long potOrFeedId;
private Role role;
private String userName;
private String type;
private String content;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public interface FeedCommentNotificationRepository extends JpaRepository<FeedCommentNotification, Long> {

@Query("SELECT new stackpot.stackpot.notification.dto.NotificationDto$UnReadNotificationDto(" +
"fcn.id, fcn.feedComment.feed.feedId, fcn.feedComment.user.role," +
"fcn.id, fcn.feedComment.feed.feedId, " +
"fcn.feedComment.user.nickname, 'FeedComment', fcn.feedComment.comment, fcn.createdAt) " +
"FROM FeedCommentNotification fcn " +
"WHERE fcn.isRead = false AND (" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public interface FeedLikeNotificationRepository extends JpaRepository<FeedLikeNotification, Long> {

@Query("SELECT new stackpot.stackpot.notification.dto.NotificationDto$UnReadNotificationDto(" +
"fln.id, fln.feedLike.feed.feedId, fln.feedLike.user.role," +
"fln.id, fln.feedLike.feed.feedId, " +
"fln.feedLike.user.nickname, 'FeedLike', null, fln.createdAt) " +
"FROM FeedLikeNotification fln " +
"WHERE fln.isRead = false and fln.feedLike.feed.user.id = :userId ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public interface PotApplicationNotificationRepository extends JpaRepository<PotApplicationNotification, Long> {

@Query("SELECT new stackpot.stackpot.notification.dto.NotificationDto$UnReadNotificationDto(" +
"pan.id, pan.potApplication.pot.potId, pan.potApplication.user.role, pan.potApplication.user.nickname, " +
"pan.id, pan.potApplication.pot.potId, pan.potApplication.user.nickname, " +
"'PotApplication', null, pan.createdAt) " +
"FROM PotApplicationNotification pan " +
"WHERE pan.isRead = false AND pan.potApplication.pot.user.id = :userId")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public interface PotCommentNotificationRepository extends JpaRepository<PotCommentNotification, Long> {

@Query("SELECT new stackpot.stackpot.notification.dto.NotificationDto$UnReadNotificationDto(" +
"pcn.id, pcn.potComment.pot.potId, pcn.potComment.user.role, " +
"pcn.id, pcn.potComment.pot.potId, " +
"pcn.potComment.user.nickname, 'PotComment', pcn.potComment.comment, pcn.createdAt) " +
"FROM PotCommentNotification pcn " +
"WHERE pcn.isRead = false AND (" +
Expand Down
Loading