Skip to content

Commit

Permalink
fix: 새로운 유저 판별 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
gunom committed Jan 8, 2024
1 parent f0517eb commit 81f4d56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public class PokeHistoryService {

private final PokeHistoryRepository pokeHistoryRepository;

public Boolean isNewPoker(Long userId) {
return pokeHistoryRepository.findAllByPokerId(userId).isEmpty();
}

public List<PokeHistory> getAllOfPokeBetween(Long userId, Long friendId) {
return pokeHistoryRepository.findAllWithFriendOrderByCreatedAtDesc(userId, friendId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,7 +35,7 @@
public class PokeController {

private final PokeFacade pokeFacade;
private final PokeHistoryService pokeHistoryService;
private final FriendService friendService;

@GetMapping("/random-user")
public ResponseEntity<List<PokeResponse.SimplePokeProfile>> getRandomUserForNew(
Expand All @@ -52,8 +53,8 @@ public ResponseEntity<List<PokeResponse.SimplePokeProfile>> getRandomUserForNew(
public ResponseEntity<PokeResponse.IsNew> 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);
}

Expand Down

0 comments on commit 81f4d56

Please sign in to comment.