Skip to content

Commit

Permalink
Merge pull request #235 from team-winey/fix/#234
Browse files Browse the repository at this point in the history
[Fix] ํ”ผ๋“œ์ƒ์„ฑ์‹œ ๋ ˆ๋ฒจ์—… ๋‹ฌ์„ฑ์—ฌ๋ถ€ bool ๊ฐ’ responseBody์— ๋‹ด๊ฒŒ๋” ์ˆ˜์ •
  • Loading branch information
alpha-kwhn authored Feb 24, 2024
2 parents c29a4f5 + 0c90e6a commit 4f65482
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
10 changes: 8 additions & 2 deletions src/main/java/org/winey/server/service/FeedService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 4f65482

Please sign in to comment.