Class MenuItemReviewController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.MenuItemReviewController
@RequestMapping("/api/menuitemreview")
@RestController
public class MenuItemReviewController
extends ApiController
This is a REST controller for MenuItemReview
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList all Menu Item ReviewspostMenuItemReview(long itemId, String reviewerEmail, int stars, String comments, LocalDateTime dateReviewed) Create a new menu item reviewupdateMenuItemReview(Long id, @Valid MenuItemReview incoming) Methods inherited from class ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
MenuItemReviewController
public MenuItemReviewController()
-
-
Method Details
-
allMenuItemReview
@PreAuthorize("hasRole('ROLE_USER')") @GetMapping("/all") public Iterable<MenuItemReview> allMenuItemReview()List all Menu Item Reviews- Returns:
- an iterable of MenuItemReview
-
postMenuItemReview
@PreAuthorize("hasRole('ROLE_ADMIN')") @PostMapping("/post") public MenuItemReview postMenuItemReview(@RequestParam long itemId, @RequestParam String reviewerEmail, @RequestParam int stars, @RequestParam String comments, @RequestParam("dateReviewed") @DateTimeFormat(iso=DATE_TIME) LocalDateTime dateReviewed) throws com.fasterxml.jackson.core.JsonProcessingException Create a new menu item review- Parameters:
itemId- the id of the item on the menureviewerEmail- the email of the reviewerstars- the rating of the mealcomments- the comment in the reviewdateReviewed- the date of the review- Returns:
- the saved menu item review
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getById
@PreAuthorize("hasRole('ROLE_USER')") @GetMapping("") public MenuItemReview getById(@RequestParam Long id) -
updateMenuItemReview
@PreAuthorize("hasRole('ROLE_ADMIN')") @PutMapping("") public MenuItemReview updateMenuItemReview(@RequestParam Long id, @RequestBody @Valid @Valid MenuItemReview incoming) -
deleteMenuItemReview
-