Class RequestTypeController

java.lang.Object
edu.ucsb.cs156.rec.controllers.ApiController
edu.ucsb.cs156.rec.controllers.RequestTypeController

@RequestMapping("/api/requesttypes") @RestController public class RequestTypeController extends ApiController
This is a REST controller for RequestType
  • Constructor Details

    • RequestTypeController

      public RequestTypeController()
  • Method Details

    • allRequestTypes

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<RequestType> allRequestTypes()
      This method returns a list of all Request Types.
      Returns:
      a list of all Request Types.
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public RequestType getById(@RequestParam Long id)
      Get a single request type by id
      Parameters:
      id - the id of the request type
      Returns:
      a RequestTYpe
    • postRequestType

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public RequestType postRequestType(@RequestParam String requestType) throws com.fasterxml.jackson.core.JsonProcessingException
      Create a new request type
      Parameters:
      requestType - the title of the request type
      Returns:
      the saved requesttype
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • deleteRequestType

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteRequestType(@RequestParam Long id)
      Delete a UCSBDate
      Parameters:
      id - the id of the request type to delete
      Returns:
      a message indicating the date was deleted
    • updateRequestType

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public RequestType updateRequestType(@RequestParam Long id, @RequestBody @Valid @Valid RequestType incoming)
      Update a single request type
      Parameters:
      id - id of the request to update
      incoming - the new request type
      Returns:
      the updated request type object