Class UserCommonsController
java.lang.Object
edu.ucsb.cs156.happiercows.controllers.ApiController
edu.ucsb.cs156.happiercows.controllers.UserCommonsController
@RequestMapping("/api/usercommons")
@RestController
public class UserCommonsController
extends ApiController
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetUserCommonsById
(Long commonsId) getUserCommonsById
(Long userId, Long commonsId) org.springframework.http.ResponseEntity<String>
getUsersCommonsByCommonsId
(Long commonsId) org.springframework.http.ResponseEntity<String>
putUserCommonsByIdBuy
(Long commonsId, int numCows) org.springframework.http.ResponseEntity<String>
putUserCommonsByIdSell
(Long commonsId, int numCows) Methods inherited from class edu.ucsb.cs156.happiercows.controllers.ApiController
genericMessage, getCurrentUser, handleBadRequest, handleGenericException
-
Constructor Details
-
UserCommonsController
public UserCommonsController()
-
-
Method Details
-
getUserCommonsById
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @GetMapping("") public UserCommons getUserCommonsById(@RequestParam Long userId, @RequestParam Long commonsId) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getUserCommonsById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/forcurrentuser") public UserCommons getUserCommonsById(@RequestParam Long commonsId) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
putUserCommonsByIdBuy
@PreAuthorize("hasRole(\'ROLE_USER\')") @PutMapping("/buy") public org.springframework.http.ResponseEntity<String> putUserCommonsByIdBuy(@RequestParam Long commonsId, @RequestParam int numCows) throws NotEnoughMoneyException, com.fasterxml.jackson.core.JsonProcessingException - Throws:
NotEnoughMoneyException
com.fasterxml.jackson.core.JsonProcessingException
-
putUserCommonsByIdSell
@PreAuthorize("hasRole(\'ROLE_USER\')") @PutMapping("/sell") public org.springframework.http.ResponseEntity<String> putUserCommonsByIdSell(@RequestParam Long commonsId, @RequestParam int numCows) throws NoCowsException, com.fasterxml.jackson.core.JsonProcessingException - Throws:
NoCowsException
com.fasterxml.jackson.core.JsonProcessingException
-
getUsersCommonsByCommonsId
@PreAuthorize("hasAnyRole(\'ROLE_USER\', \'ROLE_ADMIN\')") @GetMapping("/commons/all") public org.springframework.http.ResponseEntity<String> getUsersCommonsByCommonsId(@RequestParam Long commonsId) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-