Class UCSBMenuItemReviewController

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

@RequestMapping("/api/ucsbmenuitemreview") @RestController public class UCSBMenuItemReviewController extends ApiController
  • Constructor Details

    • UCSBMenuItemReviewController

      public UCSBMenuItemReviewController()
  • Method Details

    • allUCSBMenuItemRevies

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBMenuItemReview> allUCSBMenuItemRevies()
      List all UCSB menu item reviews
      Returns:
      an iterable of UCSBMenuItemReview
    • postUCSBMenuItemReview

      @PreAuthorize("hasRole(\'ROLE_USER\')") @PostMapping("/post") public UCSBMenuItemReview postUCSBMenuItemReview(@RequestParam long itemId, @RequestParam String reviewerEmail, @RequestParam int stars, @RequestParam("dateReviewed") @DateTimeFormat(iso=DATE_TIME) LocalDateTime dateReviewed, @RequestParam String comments) throws com.fasterxml.jackson.core.JsonProcessingException
      Create a new UCSB menu item review
      Parameters:
      itemId - the id of the menu item
      reviewerEmail - the email of the reviewer
      stars - the number of stars (0 to 5) // * @param dateReviewed the date the review was made
      comments - the comments of the review
      Returns:
      the created UCSBMenuItemReview
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • getById

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

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

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteUCSBMenuItemReview(@RequestParam Long id)
      Delete a UCSBMenuItemReview
      Parameters:
      id - the id of the review to delete
      Returns:
      a message indicating the review was deleted