From 2d062bc70261f213888837a07e9c06cb0f93cb0d Mon Sep 17 00:00:00 2001 From: Anvisimi <8444.sa@gmail.com> Date: Thu, 14 Nov 2024 19:40:17 +0800 Subject: [PATCH] kebab case --- .../controller/ApiController.java | 20 +++++++++---------- .../controller/RedisController.java | 20 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/java/sg/edu/nus/iss/shopsmart_backend/controller/ApiController.java b/src/main/java/sg/edu/nus/iss/shopsmart_backend/controller/ApiController.java index db97ad1..29a7b89 100644 --- a/src/main/java/sg/edu/nus/iss/shopsmart_backend/controller/ApiController.java +++ b/src/main/java/sg/edu/nus/iss/shopsmart_backend/controller/ApiController.java @@ -45,9 +45,9 @@ private HttpHeaders createHeaders() { return headers; } - @GetMapping("/{apiKey}/**") + @GetMapping("/{api-key}/**") public CompletableFuture> handleGetRequest( - @PathVariable String apiKey, + @PathVariable(name = "api-key") String apiKey, HttpServletRequest request, HttpServletResponse response) { HttpHeaders headers = createHeaders(); @@ -64,9 +64,9 @@ public CompletableFuture> handleGetRequest( }); } - @PostMapping("/{apiKey}/**") + @PostMapping("/{api-key}/**") public CompletableFuture> handlePostRequest( - @PathVariable String apiKey, + @PathVariable(name = "api-key") String apiKey, @RequestBody JsonNode requestBody, HttpServletRequest request, HttpServletResponse response) { @@ -84,9 +84,9 @@ public CompletableFuture> handlePostRequest( }); } - @PutMapping("/{apiKey}/**") + @PutMapping("/{api-key}/**") public CompletableFuture> handlePutRequest( - @PathVariable String apiKey, + @PathVariable(name = "api-key") String apiKey, @RequestBody JsonNode requestBody, HttpServletRequest request, HttpServletResponse response) { @@ -104,9 +104,9 @@ public CompletableFuture> handlePutRequest( }); } - @PatchMapping("/{apiKey}/**") + @PatchMapping("/{api-key}/**") public CompletableFuture> handlePatchRequest( - @PathVariable String apiKey, + @PathVariable(name = "api-key") String apiKey, @RequestBody JsonNode requestBody, HttpServletRequest request, HttpServletResponse response) { @@ -124,9 +124,9 @@ public CompletableFuture> handlePatchRequest( }); } - @DeleteMapping("/{apiKey}/**") + @DeleteMapping("/{api-key}/**") public CompletableFuture> handleDeleteRequest( - @PathVariable String apiKey, + @PathVariable(name = "api-key") String apiKey, HttpServletRequest request, HttpServletResponse response) { log.info("Handling DELETE request for API: {}", apiKey); diff --git a/src/main/java/sg/edu/nus/iss/shopsmart_backend/controller/RedisController.java b/src/main/java/sg/edu/nus/iss/shopsmart_backend/controller/RedisController.java index e9fac4c..55aa21d 100644 --- a/src/main/java/sg/edu/nus/iss/shopsmart_backend/controller/RedisController.java +++ b/src/main/java/sg/edu/nus/iss/shopsmart_backend/controller/RedisController.java @@ -27,20 +27,20 @@ public RedisController(RedisService redisService) { this.redisService = redisService; } - @PostMapping("/ddo/{apiKey}") - public ResponseEntity insertDdoDataInRedis(@PathVariable String apiKey, @RequestBody DataDynamicObject requestBody) { + @PostMapping("/ddo/{api-key}") + public ResponseEntity insertDdoDataInRedis(@PathVariable(name = "api-key") String apiKey, @RequestBody DataDynamicObject requestBody) { log.info("Inserting DDO data in Redis for API key: {}", apiKey); return ok(redisService.insertDdoDataInRedis(apiKey, requestBody)); } - @GetMapping("/ddo/{apiKey}") - public ResponseEntity getDdoDataFromRedis(@PathVariable String apiKey) { + @GetMapping("/ddo/{api-key}") + public ResponseEntity getDdoDataFromRedis(@PathVariable(name = "api-key") String apiKey) { log.info("Fetching DDO data from Redis for API key: {}", apiKey); return ok(redisService.getDdoDataFromRedis(apiKey)); } - @PostMapping("/hash/{redisKey}") - public ResponseEntity insertHashEntry(@PathVariable String redisKey, @RequestBody Map requestBody) { + @PostMapping("/hash/{redis-key}") + public ResponseEntity insertHashEntry(@PathVariable(name = "redis-key") String redisKey, @RequestBody Map requestBody) { log.info("Inserting hash entry in Redis for key: {}", redisKey); String hashKey = requestBody.get("hashKey"); String value = requestBody.get("value"); @@ -48,14 +48,14 @@ public ResponseEntity insertHashEntry(@PathVariable String redisKey, @Re return ok("Success"); } - @GetMapping("/hash/{redisKey}/{hashKey}") - public ResponseEntity getHashEntry(@PathVariable String redisKey, @PathVariable String hashKey) { + @GetMapping("/hash/{redis-key}/{hash-key}") + public ResponseEntity getHashEntry(@PathVariable(name = "redis-key") String redisKey, @PathVariable(name = "hash-key") String hashKey) { log.info("Fetching hash entry from Redis for key: {} and hash key: {}", redisKey, hashKey); return ok(redisService.getHashValue(redisKey, hashKey)); } - @GetMapping("/hash/{redisKey}") - public ResponseEntity getHashEntries(@PathVariable String redisKey) { + @GetMapping("/hash/{redis-key}") + public ResponseEntity getHashEntries(@PathVariable(name = "redis-key") String redisKey) { log.info("Fetching all hash entries from Redis for key: {}", redisKey); return ok(redisService.getHashMap(redisKey)); }