Skip to content

Commit

Permalink
๐Ÿ› [Fix] findPChangeByGameId optional ๋ฒ„๊ทธ ์ˆ˜์ • (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
kokomong2 authored Dec 22, 2023
1 parent 65ca710 commit 51377ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private void updatePchangeIsChecked(Game game, Long loginUserId) {
}

public void savePChange(Game game, List<TeamUser> teamUsers, Long loginUserId) {
if (pChangeRepository.findPChangeByGameId(game.getId()).isPresent()){
if (!pChangeRepository.findPChangesByGameId(game.getId()).isEmpty()){
return ;
}
Long team1UserId = teamUsers.get(0).getUser().getId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public interface PChangeRepository extends JpaRepository<PChange, Long> , PChang
List<PChange> findAllByUserId(@Param("userId") Long userId);

@Query(value = "SELECT pc FROM PChange pc join fetch pc.user join fetch pc.game WHERE pc.user.id = :userId and pc.game.mode in :modes order by pc.id desc")
List<PChange> findAllByUserIdGameModeIn(@Param("userId") Long userId, List<Mode> modes);
List<PChange> findAllByUserIdGameModeIn(@Param("userId") Long userId, @Param("modes") List<Mode> modes);
Optional<PChange> findByUserIdAndGameId(Long userId, Long gameId);

Optional<PChange> findPChangeByUserIdAndGameId(Long userId, Long gameId);

Optional<PChange> findPChangeByGameId(Long gameId);
List<PChange> findPChangesByGameId(Long gameId);
}

0 comments on commit 51377ba

Please sign in to comment.