|
@@ -2,6 +2,7 @@ package com.example.demo.Controller;
|
2
|
2
|
|
3
|
3
|
import com.example.demo.Entity.Game;
|
4
|
4
|
import com.example.demo.Service.GameService;
|
|
5
|
+import com.example.demo.Service.UserService;
|
5
|
6
|
import org.springframework.beans.factory.annotation.Autowired;
|
6
|
7
|
import org.springframework.http.HttpStatus;
|
7
|
8
|
import org.springframework.http.ResponseEntity;
|
|
@@ -22,7 +23,6 @@ public class GameController {
|
22
|
23
|
@PostMapping(value="/games")
|
23
|
24
|
public ResponseEntity<Game> addGame(@RequestBody Game game) {
|
24
|
25
|
return gameService.addGame(game);
|
25
|
|
-
|
26
|
26
|
}
|
27
|
27
|
|
28
|
28
|
@GetMapping(value="/games")
|
|
@@ -33,4 +33,9 @@ public class GameController {
|
33
|
33
|
|
34
|
34
|
@GetMapping(value="/games/name/{gameName}")
|
35
|
35
|
public Long getGameByName(@PathVariable String gameName){return gameService.getGameByName(gameName);}
|
|
36
|
+
|
|
37
|
+ @GetMapping(value="/games/{userId}")
|
|
38
|
+ public Collection<Game> getGamesByUserId(@PathVariable Long userId){
|
|
39
|
+ return gameService.getGamesByUserId(userId);
|
|
40
|
+ }
|
36
|
41
|
}
|