From 81f4d560a2d38333e6f8d7931429cb3064b086af Mon Sep 17 00:00:00 2001 From: gunom Date: Mon, 8 Jan 2024 23:35:07 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=83=88=EB=A1=9C=EC=9A=B4=20=EC=9C=A0?= =?UTF-8?q?=EC=A0=80=20=ED=8C=90=EB=B3=84=20=EB=A1=9C=EC=A7=81=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/sopt/app/application/poke/PokeHistoryService.java | 4 ---- .../org/sopt/app/presentation/poke/PokeController.java | 7 ++++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/sopt/app/application/poke/PokeHistoryService.java b/src/main/java/org/sopt/app/application/poke/PokeHistoryService.java index 651af213..e51f53f0 100644 --- a/src/main/java/org/sopt/app/application/poke/PokeHistoryService.java +++ b/src/main/java/org/sopt/app/application/poke/PokeHistoryService.java @@ -22,10 +22,6 @@ public class PokeHistoryService { private final PokeHistoryRepository pokeHistoryRepository; - public Boolean isNewPoker(Long userId) { - return pokeHistoryRepository.findAllByPokerId(userId).isEmpty(); - } - public List getAllOfPokeBetween(Long userId, Long friendId) { return pokeHistoryRepository.findAllWithFriendOrderByCreatedAtDesc(userId, friendId); } diff --git a/src/main/java/org/sopt/app/presentation/poke/PokeController.java b/src/main/java/org/sopt/app/presentation/poke/PokeController.java index 329c1419..2b427c3a 100644 --- a/src/main/java/org/sopt/app/presentation/poke/PokeController.java +++ b/src/main/java/org/sopt/app/presentation/poke/PokeController.java @@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor; import lombok.val; +import org.sopt.app.application.poke.FriendService; import org.sopt.app.application.poke.PokeHistoryService; import org.sopt.app.domain.entity.User; import org.sopt.app.domain.enums.Friendship; @@ -34,7 +35,7 @@ public class PokeController { private final PokeFacade pokeFacade; - private final PokeHistoryService pokeHistoryService; + private final FriendService friendService; @GetMapping("/random-user") public ResponseEntity> getRandomUserForNew( @@ -52,8 +53,8 @@ public ResponseEntity> getRandomUserForNew( public ResponseEntity getPokeList( @AuthenticationPrincipal User user ) { - val result = pokeHistoryService.isNewPoker(user.getId()); - val response = PokeResponse.IsNew.of(result); + val result = friendService.getPokeFriendIdRandomly(user.getId()); + val response = PokeResponse.IsNew.of(result.isEmpty()); return ResponseEntity.ok(response); }