Class PlayerStatController

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

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

    • PlayerStatController

      public PlayerStatController(PlayerStatRepository repository, PlayerRepository playerRepository, GameRepository gameRepository)
      Paramterised Constructor
      Parameters:
      repository - PlayerStatRepository object for CRUD operations on PLAYER_STAT database table
      playerRepository - PlayerRepository object for CRUD operations on PLAYER database table
      gameRepository - GameRepository object for CRUD operations on GAME database table
  • Method Details

    • allPlayerStats

      @CrossOrigin(origins="http://localhost:4200") @GetMapping("/player-stats") public List<PlayerStat> allPlayerStats()
      "/player-stats" endpoint: Accepts GET requests
      Returns:
      List of all PlayerStat records in the database
    • playerStats

      @CrossOrigin(origins="http://localhost:4200") @GetMapping("/player-stats/{gameId}/{playerTag}") public PlayerStat playerStats(@PathVariable UUID gameId, @PathVariable String playerTag)
      "/player-stats/{gameId}/{playerTag}" endpoing: Accepts GET requests for a single PlayerStat record
      Parameters:
      gameId - The ID for a specific Game
      playerTag - The playerTag for a specific Player
      Returns:
      A PlayerStat record for a single Player for a single Game
    • newPlayerStat

      @CrossOrigin(origins="http://localhost:4200") @PostMapping("/player-stats/update/{gameId}/{playerTag}") public PlayerStat newPlayerStat(@RequestBody PlayerStat updatePlayerStat, @PathVariable UUID gameId, @PathVariable String playerTag)
      "/player-stats/update/{gameId}/{playerTag}" endpoint: Accepts POST requests to update an existing PlayerStat record
      Parameters:
      updatePlayerStat - new PlayerStat values to be updated
      gameId - The ID for a specific game
      playerTag - The playerTag for a specific Player
      Returns:
      PlayerStat record that was updated or created in database