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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionList all help requestspostHelpRequest
(String requesterEmail, String teamId, String tableOrBreakoutRoom, String explanation, Boolean solved, LocalDateTime requestTime) Create a new help requestupdateHelpRequest
(Long id, @Valid HelpRequests incoming) Methods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
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 requesterteamId
- the ID of the teamtableOrBreakoutRoom
- the table or breakout room locationexplanation
- explanation of the help requestsolved
- status of the help request, whether it's solved or notrequestTime
- 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
-