Skip to content

Commit

Permalink
[GREEN] Implement admin controller get review by state
Browse files Browse the repository at this point in the history
  • Loading branch information
asteriskzie committed May 20, 2024
1 parent 0dd6174 commit 2f98dd8
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import snackscription.review.model.Review;
import snackscription.review.service.ReviewService;

import java.util.List;

@RestController
@RequestMapping("/admin")
public class ReviewAdminController {
Expand Down Expand Up @@ -34,4 +36,13 @@ public ResponseEntity<Review> rejectReview(@PathVariable String subsbox, @PathVa
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
}

@GetMapping("/subscription-boxes/{subsbox}/reviews")
public ResponseEntity<List<Review>> getSubsboxReviews(
@PathVariable String subsbox,
@RequestParam(required = false) String state) throws Exception {
List<Review> reviews = reviewService.getSubsboxReview(subsbox, state);
return ResponseEntity.ok().body(reviews);
}

}

0 comments on commit 2f98dd8

Please sign in to comment.