Class HelpRequestsController

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

@RestController @RequestMapping("/api/HelpRequests") public class HelpRequestsController extends ApiController
This is a REST controller for managing Help Requests
  • Constructor Details

    • HelpRequestsController

      public HelpRequestsController()
  • Method Details

    • allHelpRequests

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

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public HelpRequests postHelpRequest(@RequestParam String requesterEmail, @RequestParam String teamId, @RequestParam String tableOrBreakoutRoom, @RequestParam String explanation, @RequestParam Boolean solved, @RequestParam @DateTimeFormat(iso=DATE_TIME) LocalDateTime requestTime)
      Create a new help request
      Parameters:
      requesterEmail - the email of the requester
      teamId - the ID of the team
      tableOrBreakoutRoom - the table or breakout room location
      explanation - explanation of the help request
      solved - status of the help request, whether it's solved or not
      requestTime - the time the request was made
      Returns:
      the newly created help request
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public HelpRequests getById(@RequestParam Long id)
    • updateHelpRequest

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public HelpRequests updateHelpRequest(@RequestParam Long id, @RequestBody @Valid @Valid HelpRequests incoming)
    • deleteHelpRequest

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteHelpRequest(@RequestParam Long id)