From ac0a9c17702a6917f0aac931e6e7fc84ca9bf96c Mon Sep 17 00:00:00 2001 From: Gabriel Torelo <57268681+GabrielTorelo@users.noreply.github.com> Date: Sun, 16 Jul 2023 07:40:11 -0300 Subject: [PATCH] =?UTF-8?q?cria=20m=C3=A9todo=20'readListID'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gabriel_torelo/game_list/services/GameService.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/gabriel_torelo/game_list/services/GameService.java b/src/main/java/com/gabriel_torelo/game_list/services/GameService.java index 689ad6f..0f09237 100644 --- a/src/main/java/com/gabriel_torelo/game_list/services/GameService.java +++ b/src/main/java/com/gabriel_torelo/game_list/services/GameService.java @@ -8,6 +8,7 @@ import com.gabriel_torelo.game_list.dto.GameMinDTO; import com.gabriel_torelo.game_list.dto.GameShortDTO; import com.gabriel_torelo.game_list.entities.Game; +import com.gabriel_torelo.game_list.projections.GameMinProjection; import com.gabriel_torelo.game_list.repositories.GameRepository; @Service @@ -36,4 +37,11 @@ public GameLongDTO readMoreID(Long id) { return new GameLongDTO(rGame); } + + @Transactional(readOnly = true) + public List readListID(Long id) { + List rGameProj = gameRepository.readListID(id); + + return rGameProj.stream().map(gameProject -> new GameMinDTO(gameProject)).toList(); + } }