Skip to content

Commit 0e5dcde

Browse files
Merge pull request #34 from GabrielTorelo/feat/gameListController
feat/gameListController#003 - OK
2 parents c48b402 + 171a6e6 commit 0e5dcde

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/java/com/gabriel_torelo/game_list/controllers/GameListController.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
import org.springframework.beans.factory.annotation.Autowired;
55
import org.springframework.web.bind.annotation.GetMapping;
66
import org.springframework.web.bind.annotation.PathVariable;
7+
import org.springframework.web.bind.annotation.PostMapping;
8+
import org.springframework.web.bind.annotation.RequestBody;
79
import org.springframework.web.bind.annotation.RequestMapping;
810
import org.springframework.web.bind.annotation.RestController;
11+
import com.gabriel_torelo.game_list.dto.ChangePositionDTO;
912
import com.gabriel_torelo.game_list.dto.GameListDTO;
1013
import com.gabriel_torelo.game_list.dto.GameMinDTO;
1114
import com.gabriel_torelo.game_list.services.GameListService;
@@ -35,4 +38,9 @@ public GameListDTO readID(@PathVariable Long id) {
3538
public List<GameMinDTO> readListID(@PathVariable Long id) {
3639
return gameService.readListID(id);
3740
}
41+
42+
@PostMapping(value = "/{id}/change")
43+
public void moveGame(@PathVariable Long id, @RequestBody ChangePositionDTO reqBody) {
44+
gameListService.moveGame(id, reqBody.getCurrentIndex(), reqBody.getNewIndex());
45+
}
3846
}

0 commit comments

Comments
 (0)