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 TypeMethodDescriptionTHis method returns a list of all help requests.This method returns a single help request.postHelpRequest(String requesterEmail, String teamId, String tableOrBreakoutRoom, LocalDateTime requestTime, String explanation, boolean solved) This method creates a new help request.Methods 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()THis method returns a list of all help requests.- Returns:
- a list of all help requests
-
postHelpRequest
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public HelpRequest postHelpRequest(@RequestParam String requesterEmail, @RequestParam String teamId, @RequestParam String tableOrBreakoutRoom, @RequestParam @DateTimeFormat(iso=DATE_TIME) LocalDateTime requestTime, @RequestParam String explanation, @RequestParam boolean solved) This method creates a new help request. Accessible only to users with the role "ROLE_ADMIN". creating params based on these:- Parameters:
requesterEmail- email of the requesterteamId- team ID of the requestertableOrBreakoutRoom- table or breakout room of the requesterrequestTime- time of the requestexplanation- explanation of the requestsolved- whether the request is solved- Returns:
- the created help request
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public HelpRequest getById(@RequestParam Long id) This method returns a single help request.- Parameters:
id- id of the help request- Returns:
- a single help request
-