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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDeletes a restaurant.postHelpRequest
(String requesterEmail, String teamId, String tableOrBreakoutRoom, LocalDateTime requestTime, String explanation, Boolean solved) updateHelpRequest
(Long id, @Valid HelpRequest incoming) Update a single restaurant.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() -
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public HelpRequest getById(@RequestParam Long id) -
postHelpRequest
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public HelpRequest postHelpRequest(@RequestParam String requesterEmail, @RequestParam String teamId, @RequestParam String tableOrBreakoutRoom, @RequestParam LocalDateTime requestTime, @RequestParam String explanation, @RequestParam Boolean solved) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
deleteHelpRequest
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteHelpRequest(@RequestParam Long id) Deletes a restaurant. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
id
- id of the restaurant to delete- Returns:
- a message indicating that the restaurant was deleted
-
updateHelpRequest
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public HelpRequest updateHelpRequest(@RequestParam Long id, @RequestBody @Valid @Valid HelpRequest incoming) Update a single restaurant. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
id
- id of the restaurant to updateincoming
- the new restaurant contents- Returns:
- the updated restaurant object
-