Class MenuItemReviewController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.MenuItemReviewController
@RestController
@RequestMapping("/api/menuitemreview")
public class MenuItemReviewController
extends ApiController
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateMenuItemReview
(long id, long itemId, String reviewEmail, int stars, LocalDateTime dateReviewed, String comments) deleteMenuItemReview
(long id) getMenuItemReviewById
(long id) updateMenuItemReview
(long id, @Valid MenuItemReviews updatedReview) Methods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
MenuItemReviewController
public MenuItemReviewController()
-
-
Method Details
-
getAllMenuItemReviews
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<MenuItemReviews> getAllMenuItemReviews() -
createMenuItemReview
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public MenuItemReviews createMenuItemReview(@RequestParam long id, @RequestParam long itemId, @RequestParam String reviewEmail, @RequestParam int stars, @RequestParam("dateReviewed") @DateTimeFormat(iso=DATE_TIME) LocalDateTime dateReviewed, @RequestParam String comments) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getMenuItemReviewById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public MenuItemReviews getMenuItemReviewById(@RequestParam long id) -
updateMenuItemReview
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public MenuItemReviews updateMenuItemReview(@RequestParam long id, @RequestBody @Valid @Valid MenuItemReviews updatedReview) -
deleteMenuItemReview
@DeleteMapping("") @PreAuthorize("hasRole(\'ROLE_ADMIN\')") public String deleteMenuItemReview(@RequestParam long id) throws EntityNotFoundException - Throws:
EntityNotFoundException
-