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 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:
      NotEnoughMoneyException
      com.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:
      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