There was an error while loading. Please reload this page.
1 parent 88f98a5 commit 4e94f7cCopy full SHA for 4e94f7c
src/main/java/com/gabriel_torelo/game_list/repositories/GameListRepository.java
@@ -1,8 +1,18 @@
1
package com.gabriel_torelo.game_list.repositories;
2
3
import org.springframework.data.jpa.repository.JpaRepository;
4
+import org.springframework.data.jpa.repository.Modifying;
5
+import org.springframework.data.jpa.repository.Query;
6
import com.gabriel_torelo.game_list.entities.GameList;
7
8
public interface GameListRepository extends JpaRepository<GameList, Long> {
9
10
+ @Modifying
11
+ @Query(nativeQuery = true, value = """
12
+ UPDATE tb_belonging
13
+ SET position = :newIndex
14
+ WHERE list_id = :listID
15
+ AND game_id = :gameID
16
+ """)
17
+ void moveGameInList(Long listID, Long gameID, Integer newIndex);
18
}
0 commit comments