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.
This commit is contained in:
parent
5df6a65f1b
commit
6b588cba8c
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user