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
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptiondeleteUCSBDate(Long id) Delete a MenuItemReviewGet a single MenuItemReview by idpostMenuItemReview(Long itemId, String reviewerEmail, int stars, String comments, LocalDateTime dateReviewed) Create a new MenuItemReviewupdateMenuItemReview(Long id, @Valid MenuItemReview incoming) Update a single MenuItemReviewMethods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException 
- 
Constructor Details
- 
MenuItemReviewController
public MenuItemReviewController() 
 - 
 - 
Method Details
- 
allMenuItemReviews
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<MenuItemReview> allMenuItemReviews() - 
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public MenuItemReview getById(@RequestParam Long id) Get a single MenuItemReview by id- Parameters:
 id- the id of the review- Returns:
 - a 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 MenuItemReview- Parameters:
 itemId- the id of the item to be reviewedreviewerEmail- the email of the reviewerstars- the number of stars given in the reviewcomments- the comments of the reviewdateReviewed- the date- Returns:
 - the saved ucsbdate
 - Throws:
 com.fasterxml.jackson.core.JsonProcessingException
 - 
deleteUCSBDate
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteUCSBDate(@RequestParam Long id) Delete a MenuItemReview- Parameters:
 id- the id of the review to delete- Returns:
 - a message indicating the review was deleted
 
 - 
updateMenuItemReview
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public MenuItemReview updateMenuItemReview(@RequestParam Long id, @RequestBody @Valid @Valid MenuItemReview incoming) Update a single MenuItemReview- Parameters:
 id- id of the review to updateincoming- the new review- Returns:
 - the updated date object
 
 
 -