Class HelpRequestController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.HelpRequestController
@RequestMapping("/api/helprequest")
@RestController
public class HelpRequestController
extends ApiController
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionList all HelpRequestsDelete a HelpRequestGet a single request by idpostMenuItemReview
(String requesterEmail, String teamId, String tableOrBreakoutRoom, LocalDateTime requestTime, String explanation, boolean solved) Post a new HelpRequestupdateMenuItemReview
(Long id, @Valid HelpRequest incoming) Update a single reviewMethods 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 HelpRequests- Returns:
- an iterable of HelpRequest
-
postMenuItemReview
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public HelpRequest postMenuItemReview(@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 Post a new HelpRequest- Parameters:
requesterEmail
-teamId
-tableOrBreakoutRoom
-requestTime
-explanation
-solved
-- Returns:
- the new HelpRequest
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public HelpRequest getById(@RequestParam Long id) Get a single request by id- Parameters:
id
- the id of the review- Returns:
- a HelpRequest object
-
deleteHelpRequest
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteHelpRequest(@RequestParam Long id) Delete a HelpRequest- Parameters:
id
- the id of the review to delete- Returns:
- a message indicating the review was deleted
-
updateMenuItemReview
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public HelpRequest updateMenuItemReview(@RequestParam Long id, @RequestBody @Valid @Valid HelpRequest incoming) Update a single review- Parameters:
id
- id of the review to updateincoming
- the new review- Returns:
- the updated review object
-