Package com.fyp.tauceti.controller
Class GameStatController
java.lang.Object
com.fyp.tauceti.controller.GameStatController
Spring Controller for interacting with the GAME database table through web APIs
- See Also:
-
Constructor Summary
ConstructorDescriptionGameStatController
(GameStatRepository repository, GameRepository gameRepository) Parameterised Constructor -
Method Summary
Modifier and TypeMethodDescription"/game-stats" endpoint: Accepts GET requests"/game-stats/{id}" endpoint: Accepts GET requests for a specific GameStat record.newGameStat
(GameStat updatedGameStat, UUID gameId) "/game-stats/update/{gameId}" endpoint: Accepts POST request for updating a GameStat record in the database
-
Constructor Details
-
GameStatController
Parameterised Constructor- Parameters:
repository
- GameStatRepository object for CRUD operations on GAME_STAT database tablegameRepository
- GameRepository object for CRUD operations on GAME database table
-
-
Method Details
-
allGameStats
@CrossOrigin(origins="http://localhost:4200") @GetMapping("/game-stats") public List<GameStat> allGameStats()"/game-stats" endpoint: Accepts GET requests- Returns:
- A list of all GameStats records in the database
-
gameStat
@CrossOrigin(origins="http://localhost:4200") @GetMapping("/game-stats/{id}") public GameStat gameStat(@PathVariable UUID id) "/game-stats/{id}" endpoint: Accepts GET requests for a specific GameStat record. Searches database for any GameStat records matching the passed ID- Parameters:
id
- The ID for a specific Game- Returns:
- The requested GameStat record if it exists, or else an empty GameStat record
-
newGameStat
@CrossOrigin(origins="http://localhost:4200") @PostMapping("/game-stats/update/{gameId}") public GameStat newGameStat(@RequestBody GameStat updatedGameStat, @PathVariable UUID gameId) "/game-stats/update/{gameId}" endpoint: Accepts POST request for updating a GameStat record in the database- Parameters:
updatedGameStat
- new GameStat record to be updated in the databasegameId
- The ID for a specific Game- Returns:
- the saved GameStat record
-