content: package com.alibou.book.feedback;
  
  import com.alibou.book.common.PageResponse;
  import io.swagger.v3.oas.annotations.tags.Tag;
  import jakarta.validation.Valid;
  import lombok.RequiredArgsConstructor;
  import org.springframework.http.ResponseEntity;
  import org.springframework.security.core.Authentication;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.PostMapping;
  import org.springframework.web.bind.annotation.RequestBody;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestParam;
  import org.springframework.web.bind.annotation.RestController;
  
  @RestController
  @RequestMapping("feedbacks")
  @RequiredArgsConstructor
  @Tag(name = "Feedback")
  public class FeedbackController {
  
      private final FeedbackService service;
  
      @PostMapping
      public ResponseEntity<Integer> saveFeedback(
              @Valid @RequestBody FeedbackRequest request,
              Authentication connectedUser
      ) {
          return ResponseEntity.ok(service.save(request, connectedUser));
      }
  
      @GetMapping("/book/{book-id}")
      public ResponseEntity<PageResponse<FeedbackResponse>> findAllFeedbacksByBook(
              @PathVariable("book-id") Integer bookId,
              @RequestParam(name = "page", defaultValue = "0", required = false) int page,
              @RequestParam(name = "size", defaultValue = "10", required = false) int size,
              Authentication connectedUser
      ) {
          return ResponseEntity.ok(service.findAllFeedbacksByBook(bookId, page, size, connectedUser));
      }
  }
  