Review Update Controller

Building on our review update service implementation, we'll now create the REST API endpoint that allows users to update their restaurant reviews.

Implementing the Update Endpoint

Let's add the update endpoint to our ReviewController class:

@PutMapping("/{reviewId}") public ResponseEntity<ReviewDto> updateReview( @PathVariable String restaurantId, @PathVariable String reviewId, @Valid @RequestBody ReviewCreateUpateRequestDto review, @AuthenticationPrincipal Jwt jwt) { // Convert the DTO to domain object ReviewCreateUpdateRequest reviewCreateUpdateRequest = reviewMapper.toCreateUpdateReviewRequest(review); // Extract user information from JWT User user = jwtToUser(jwt); // Call service to perform update Review updatedReview = reviewService.updateReview( user, restaurantId, reviewId, reviewCreateUpdateRequest); // Return updated review return ResponseEntity.ok(reviewMapper.toDto(updatedReview)); }

Summary

  • Implemented endpoint for review updates
  • Reused jwtToUser private method to pass the user
© 2026 Devtiro Ltd. All rights reserved