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
Constructors -
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) org.springframework.http.ResponseEntity<String>putUserCommonsByIdSell(Long commonsId) 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) throws NotEnoughMoneyException, com.fasterxml.jackson.core.JsonProcessingException - Throws:
NotEnoughMoneyExceptioncom.fasterxml.jackson.core.JsonProcessingException
-
putUserCommonsByIdSell
@PreAuthorize("hasRole(\'ROLE_USER\')") @PutMapping("/sell") public org.springframework.http.ResponseEntity<String> putUserCommonsByIdSell(@RequestParam Long commonsId) throws NoCowsException, com.fasterxml.jackson.core.JsonProcessingException - Throws:
NoCowsExceptioncom.fasterxml.jackson.core.JsonProcessingException
-
getUsersCommonsByCommonsId
@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
-