From 6b588cba8c2306423cf88f1b507c666a13b9b427 Mon Sep 17 00:00:00 2001 From: Erik Foris Date: Tue, 25 Jun 2024 09:19:24 +0200 Subject: [PATCH] Refactor DatasetController and DatasetService, update upvote and downvote endpoints This commit refactors the `DatasetController` and `DatasetService` classes to update the endpoints for upvoting and downvoting datasets. The `@PostMapping` annotations are replaced with `@PutMapping` annotations to better align with RESTful conventions. This change improves the clarity and consistency of the API endpoints. --- .../PADAS/group3/DataDash/controler/DatasetController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/uni_passau/fim/PADAS/group3/DataDash/controler/DatasetController.java b/src/main/java/de/uni_passau/fim/PADAS/group3/DataDash/controler/DatasetController.java index 64f92cd..1fc3c2e 100644 --- a/src/main/java/de/uni_passau/fim/PADAS/group3/DataDash/controler/DatasetController.java +++ b/src/main/java/de/uni_passau/fim/PADAS/group3/DataDash/controler/DatasetController.java @@ -51,19 +51,19 @@ public class DatasetController { datasetService.deleteDataset(id); } - @PostMapping("/id/{id}/upvote") + @PutMapping("/id/{id}/upvote") public Dataset upvote(@PathVariable("id") UUID id) { datasetService.upvoteDataset(id); return null; } - @PostMapping("/id/{id}/downvote") + @PutMapping("/id/{id}/downvote") public Dataset downvote(@PathVariable("id") UUID id) { datasetService.downvoteDataset(id); return null; // new ResponseEntity<>(null, HttpStatus.OK); } - @PostMapping("/id/{id}/vote") + @PutMapping("/id/{id}/vote") public String postMethodName(@PathVariable("id") UUID id, @RequestParam("stars") int stars) { if (stars > 0 && stars < 6) {