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 Menu Item Reviews
  • Constructor Details

    • MenuItemReviewController

      public MenuItemReviewController()
  • Method Details

    • allmenuitemreviews

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<MenuItemReview> allmenuitemreviews()
      List all reviews
      Returns:
      an iterable of menu item reviews
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public MenuItemReview getById(@RequestParam Long id)
      Get a single review by id
      Parameters:
      id - the id of the review
      Returns:
      a menuItemReview
    • postitemreview

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public MenuItemReview postitemreview(@RequestParam String reviewerEmail, @RequestParam int stars, @RequestParam String comments, @RequestParam @DateTimeFormat(iso=DATE_TIME) LocalDateTime dateReviewed) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • deleteMenuItemReview

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteMenuItemReview(@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 review
      Parameters:
      id - id of the review to update
      incoming - the new review
      Returns:
      the updated review object