Skip to content

Commit

Permalink
Merge pull request #249 from Arquisoft/fix/api/missing-select
Browse files Browse the repository at this point in the history
Fix: missing 'SELECT' in API
  • Loading branch information
UO283615 authored Apr 18, 2024
2 parents c896537 + c81b41d commit c1b4924
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/src/main/java/lab/en2b/quizapi/game/GameRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public interface GameRepository extends JpaRepository<Game,Long> {
@Query(value = "SELECT * FROM Games g WHERE user_id = ?1 AND g.is_game_over = false LIMIT 1", nativeQuery = true)
Optional<Game> findActiveGameForUser(Long userId);

@Query(value = "COUNT(*) FROM Games g WHERE user_id = ?1 AND g.is_game_over = true", nativeQuery = true)
@Query(value = "SELECT COUNT(*) FROM Games g WHERE user_id = ?1 AND g" +
".is_game_over = true", nativeQuery = true)
Long countFinishedGamesForUser(Long userId);
}

0 comments on commit c1b4924

Please sign in to comment.