From 171a6e685ea64ca0192d17a45c5971e46f9243c7 Mon Sep 17 00:00:00 2001 From: Gabriel Torelo <57268681+GabrielTorelo@users.noreply.github.com> Date: Mon, 17 Jul 2023 21:03:02 -0300 Subject: [PATCH] =?UTF-8?q?cria=20m=C3=A9todo=20'moveGame'=20que=20recebe?= =?UTF-8?q?=20parametros=20do=20corpo=20(body)=20da=20requisi=C3=A7=C3=A3o?= =?UTF-8?q?=20e=20os=20envia=20ao=20'GameListService'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game_list/controllers/GameListController.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/gabriel_torelo/game_list/controllers/GameListController.java b/src/main/java/com/gabriel_torelo/game_list/controllers/GameListController.java index c3517e7..c23d443 100644 --- a/src/main/java/com/gabriel_torelo/game_list/controllers/GameListController.java +++ b/src/main/java/com/gabriel_torelo/game_list/controllers/GameListController.java @@ -4,8 +4,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import com.gabriel_torelo.game_list.dto.ChangePositionDTO; import com.gabriel_torelo.game_list.dto.GameListDTO; import com.gabriel_torelo.game_list.dto.GameMinDTO; import com.gabriel_torelo.game_list.services.GameListService; @@ -35,4 +38,9 @@ public GameListDTO readID(@PathVariable Long id) { public List readListID(@PathVariable Long id) { return gameService.readListID(id); } + + @PostMapping(value = "/{id}/change") + public void moveGame(@PathVariable Long id, @RequestBody ChangePositionDTO reqBody) { + gameListService.moveGame(id, reqBody.getCurrentIndex(), reqBody.getNewIndex()); + } }