Class GameStatController

java.lang.Object
com.fyp.tauceti.controller.GameStatController

@RestController public class GameStatController extends Object
Spring Controller for interacting with the GAME database table through web APIs
See Also:
  • Constructor Details

    • GameStatController

      public GameStatController(GameStatRepository repository, GameRepository gameRepository)
      Parameterised Constructor
      Parameters:
      repository - GameStatRepository object for CRUD operations on GAME_STAT database table
      gameRepository - 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 database
      gameId - The ID for a specific Game
      Returns:
      the saved GameStat record