Class GameController
java.lang.Object
edu.ucsb.cs156.happiercows.controllers.ApiController
edu.ucsb.cs156.happiercows.controllers.GameController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<String> createGame(CreateGameParams params) deleteGame(Long id) deleteUserFromCommon(Long gameId, Long userId) org.springframework.http.ResponseEntity<Game> org.springframework.http.ResponseEntity<String> getGame()getGameById(Long id) org.springframework.http.ResponseEntity<String> getGamePlusById(long id) getGameTimeSeries(Long commonId) getNumCowsForGameId(Long gameId) org.springframework.http.ResponseEntity<String> joinCommon(Long gameId) org.springframework.http.ResponseEntity<String> org.springframework.http.ResponseEntity<Game> updateDashboardSettings(long id, DashboardSettingsParams params) org.springframework.http.ResponseEntity<String> updateGame(long id, CreateGameParams params) static voidvalidateDates(CreateGameParams params) Enforce that both dates are present and that the last date is strictly after the starting date.Methods inherited from class ApiController
genericMessage, getCurrentUser, handleBadRequest, handleForbidden, handleGenericException
-
Constructor Details
-
GameController
public GameController()
-
-
Method Details
-
getDefaultGame
@GetMapping("/defaults") public org.springframework.http.ResponseEntity<Game> getDefaultGame() throws com.fasterxml.jackson.core.JsonProcessingException- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getGame
@GetMapping("/all") public org.springframework.http.ResponseEntity<String> getGame() throws com.fasterxml.jackson.core.JsonProcessingException- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getGamePlus
@GetMapping("/allplus") public org.springframework.http.ResponseEntity<String> getGamePlus() throws com.fasterxml.jackson.core.JsonProcessingException- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getGamePlusById
@PreAuthorize("hasRole('ROLE_USER')") @GetMapping("/plus") public GamePlus getGamePlusById(@RequestParam long id) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
updateGame
@PreAuthorize("hasRole('ROLE_ADMIN')") @PutMapping("/update") public org.springframework.http.ResponseEntity<String> updateGame(@RequestParam long id, @RequestBody CreateGameParams params) -
getGameById
-
createGame
@PreAuthorize("hasRole('ROLE_ADMIN')") @PostMapping(value="/new", produces="application/json") public org.springframework.http.ResponseEntity<String> createGame(@RequestBody CreateGameParams params) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
validateDates
Enforce that both dates are present and that the last date is strictly after the starting date. (See issue #250; the frontend form enforces the same rules, but the backend must not rely on that.)- Parameters:
params- the params to validate
-
listCowHealthUpdateStrategies
@PreAuthorize("hasRole('ROLE_USER')") @GetMapping("/all-health-update-strategies") public org.springframework.http.ResponseEntity<String> listCowHealthUpdateStrategies() throws com.fasterxml.jackson.core.JsonProcessingException- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getMyCourseIds
-
joinCommon
-
deleteGame
-
deleteUserFromCommon
-
updateDashboardSettings
@PreAuthorize("hasRole('ROLE_ADMIN')") @PutMapping("/dashboardSettings") public org.springframework.http.ResponseEntity<Game> updateDashboardSettings(@RequestParam long id, @RequestBody DashboardSettingsParams params) -
getNumCowsForGameId
-
getGameTimeSeries
-