File tree Expand file tree Collapse file tree
src/main/java/com/gabriel_torelo/game_list/services Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com .gabriel_torelo .game_list .services ;
2+
3+ import java .util .List ;
4+ import org .springframework .beans .factory .annotation .Autowired ;
5+ import org .springframework .stereotype .Service ;
6+ import org .springframework .transaction .annotation .Transactional ;
7+ import com .gabriel_torelo .game_list .dto .GameListDTO ;
8+ import com .gabriel_torelo .game_list .entities .GameList ;
9+ import com .gabriel_torelo .game_list .repositories .GameListRepository ;
10+
11+ @ Service
12+ public class GameListService {
13+
14+ @ Autowired
15+ private GameListRepository gamelistRepository ;
16+
17+ @ Transactional (readOnly = true )
18+ public List <GameListDTO > readAll () {
19+ List <GameList > rGameLists = gamelistRepository .findAll ();
20+
21+ return rGameLists .stream ().map (gameListEntity -> new GameListDTO (gameListEntity )).toList ();
22+ }
23+
24+ @ Transactional (readOnly = true )
25+ public GameListDTO readID (Long id ) {
26+ GameList rGameList = gamelistRepository .findById (id ).get ();
27+
28+ return new GameListDTO (rGameList );
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments