diff --git a/pom.xml b/pom.xml index 77cfcd1..0c77ce9 100644 --- a/pom.xml +++ b/pom.xml @@ -54,6 +54,22 @@ spring-boot-starter-test test + + io.jsonwebtoken + jjwt-api + 0.11.5 + + + io.jsonwebtoken + jjwt-impl + 0.11.5 + + + io.jsonwebtoken + jjwt-jackson + 0.11.5 + + org.springframework.boot spring-boot-starter-data-jdbc diff --git a/src/main/java/com/guams/review/controller/CommentController.java b/src/main/java/com/guams/review/controller/CommentController.java index 25b1258..4686222 100644 --- a/src/main/java/com/guams/review/controller/CommentController.java +++ b/src/main/java/com/guams/review/controller/CommentController.java @@ -38,8 +38,8 @@ public class CommentController { return commentService.findById(id).orElseThrow(() -> new NotFoundException("Comment not found")); } - @PostMapping("/posts/{id}") - public ResponseEntity addComment(@RequestBody Comment comment, Authentication authentication, @PathVariable("id") Long postId) { + @PostMapping("/posts/{post-id}") + public ResponseEntity addComment(@RequestBody Comment comment, Authentication authentication, @PathVariable("post-id") Long postId) { if (authentication == null || !authentication.isAuthenticated()) { throw new ForbiddenExecption("You are not authorized to access this resource"); } @@ -54,8 +54,8 @@ public class CommentController { return new ResponseEntity<>(insertedComment, HttpStatus.CREATED); } - @GetMapping("/posts/{id}") - public List listCommentsByPostId(@PathVariable("id") Long postId) { + @GetMapping("/posts/{post-id}") + public List listCommentsByPostId(@PathVariable("post-id") Long postId) { postService.findById(postId).orElseThrow(() -> new NotFoundException("Post not found")); return commentService.getCommentsByCommentId(postId); }