@RestController
@RequestMapping("/api/inventory")
@RequiredArgsConstructor
@Slf4j
public class InventoryController {
private final InventoryService inventoryService;
// http://localhost:8082/api/inventory/iphone-13,iphone13-red
// http://localhost:8082/api/inventory?skuCode=iphone-13&skuCode=iphone13-red
@GetMapping
@ResponseStatus(HttpStatus.OK)
public List<InventoryResponse> isInStock(@RequestParam List<String> skuCode) {
log.info("Received inventory check request for skuCode: {}", skuCode);
return inventoryService.isInStock(skuCode);
}
}
Code language: PHP (php)