Code: Select all
@RestController
@RequestMapping(
path = "/api/products",
produces = {MediaType.APPLICATION_JSON_VALUE})
@AllArgsConstructor
@Validated
public class ProductController {
private ProductService productService;
@GetMapping
public ResponseEntity
> getProducts(
@RequestParam(required = false) BigDecimal minPrice,
@RequestParam(required = false) BigDecimal maxPrice,
@PageableDefault(size = 100) Pageable pageable) {
PageDto products = productService.findProducts(minPrice, maxPrice, pageable);
return ResponseEntity.status(HttpStatus.OK).body(products);
}
// other functions here
}