Class HelpRequestController

java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.HelpRequestController

@RequestMapping("/api/helprequests") @RestController public class HelpRequestController extends ApiController
This is a REST controller for HelpRequests
  • Constructor Details

    • HelpRequestController

      public HelpRequestController()
  • Method Details

    • allHelpRequests

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<HelpRequest> allHelpRequests()
      List all slack HelpRequests
      Returns:
      an iterable of Helprequests
    • postHelpRequest

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public HelpRequest postHelpRequest(@RequestParam String requesterEmail, @RequestParam String teamId, @RequestParam String tableOrBreakoutRoom, @RequestParam String explanation, @RequestParam String solved, @RequestParam("requestTime") @DateTimeFormat(iso=DATE_TIME) LocalDateTime requestTime) throws com.fasterxml.jackson.core.JsonProcessingException
      Create a new helprequest
      Parameters:
      requesterEmail - the requesters email
      teamId - the id of the slack team
      tableOrBreakoutRoom - the table/breakoutroom of the team
      explanation - the explanation with the associated helprequest
      solved - a boolen indicating weather the request has been solved or not
      requestTime - the requesttime of the helprequest
      Returns:
      the saved helprequest
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public HelpRequest getById(@RequestParam Long id)
      Get a single helprequest by id
      Parameters:
      id - the id of the helprequest
      Returns:
      the helprequest