diff --git a/src/main/java/org/winey/server/controller/response/feed/CreateFeedResponseDto.java b/src/main/java/org/winey/server/controller/response/feed/CreateFeedResponseDto.java index 7fcb7ea..accccd1 100644 --- a/src/main/java/org/winey/server/controller/response/feed/CreateFeedResponseDto.java +++ b/src/main/java/org/winey/server/controller/response/feed/CreateFeedResponseDto.java @@ -13,9 +13,10 @@ public class CreateFeedResponseDto { private Long feedId; private LocalDateTime createdAt; + private Boolean levelUpgraded; - public static CreateFeedResponseDto of(Long feedId, LocalDateTime createdAt){ - return new CreateFeedResponseDto(feedId, createdAt); + public static CreateFeedResponseDto of(Long feedId, LocalDateTime createdAt, Boolean levelUpgraded){ + return new CreateFeedResponseDto(feedId, createdAt, levelUpgraded); } } diff --git a/src/main/java/org/winey/server/service/FeedService.java b/src/main/java/org/winey/server/service/FeedService.java index fcebadb..b31c734 100644 --- a/src/main/java/org/winey/server/service/FeedService.java +++ b/src/main/java/org/winey/server/service/FeedService.java @@ -74,11 +74,17 @@ public CreateFeedResponseDto createFeed(CreateFeedRequestDto request, Long userI // 5. 레벨업을 체크한다. UserLevel newUserLevel = UserLevel.calculateUserLevel(presentUser.getSavedAmount(), presentUser.getSavedCount()); + // 레벨업 달성 여부 담는 Bool 값 + Boolean levelUpgraded = false; + if (presentUser.getUserLevel() != newUserLevel) { // 4-1. 레벨업한다. presentUser.updateUserLevel(newUserLevel); - // 4-2. 레벨업 알림을 생성한다. + // 4-2. 레벨업 달성 여부를 true로 수정 + levelUpgraded = true; + + // 4-3. 레벨업 알림을 생성한다. switch (newUserLevel) { case KNIGHT: notificationBuilderInFeed(NotiType.RANKUPTO2, presentUser); @@ -94,7 +100,7 @@ public CreateFeedResponseDto createFeed(CreateFeedRequestDto request, Long userI } } - return CreateFeedResponseDto.of(feed.getFeedId(), feed.getCreatedAt()); + return CreateFeedResponseDto.of(feed.getFeedId(), feed.getCreatedAt(), levelUpgraded); } @Transactional