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 Help Requests
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList all help requestspostHelpRequest(String requesterEmail, String teamId, String tableOrBreakoutRoom, LocalDateTime requestTime, String explanation, boolean solved) Create a help requestMethods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
HelpRequestController
public HelpRequestController()
-
-
Method Details
-
allHelpRequests
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<HelpRequest> allHelpRequests()List all help requests- Returns:
- an iterable of HelpRequest
-
postHelpRequest
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public HelpRequest postHelpRequest(@RequestParam String requesterEmail, @RequestParam String teamId, @RequestParam String tableOrBreakoutRoom, @RequestParam("requestTime") @DateTimeFormat(iso=DATE_TIME) LocalDateTime requestTime, @RequestParam String explanation, @RequestParam boolean solved) throws com.fasterxml.jackson.core.JsonProcessingException Create a help request- Parameters:
requesterEmail- the email of the help requesterteamId- the name of the datetableOrBreakoutRoom- table or breakout room number of the help requesterrequestTime- the time of the help requestexplanation- the explanation of the help requestsolved- the solution status of the help request- Returns:
- the saved HelpRequest
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-