Class MenuItemReviewController

java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.MenuItemReviewController

@RequestMapping("/api/menu_item_review") @RestController public class MenuItemReviewController extends ApiController
This is a REST controller for MenuItemReview
  • Constructor Details

    • MenuItemReviewController

      public MenuItemReviewController()
  • Method Details

    • allMenuReviews

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

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public MenuItemReview getById(@RequestParam Long id)
      Get a single date by id
      Parameters:
      id - the id of the date
      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 review
      Parameters:
      itemId -
      reviewerEmail -
      stars -
      comments -
      dateReviewed - date
      Returns:
      the saved menuItemReview
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • deleteMenuItem

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteMenuItem(@RequestParam Long id)
      Delete a MenuItemReview
      Parameters:
      id - the id of the date to delete
      Returns:
      a message indicating the date was deleted
    • updateMenuItemReview

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public MenuItemReview updateMenuItemReview(@RequestParam Long id, @RequestBody @Valid @Valid MenuItemReview incoming)
      Update a single date
      Parameters:
      id - id of the date to update
      incoming - the new date
      Returns:
      the updated date object