update du pom.xml
This commit is contained in:
parent
6867abd767
commit
a2bc87e1a9
16
pom.xml
16
pom.xml
@ -54,6 +54,22 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-api</artifactId>
|
||||
<version>0.11.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-impl</artifactId>
|
||||
<version>0.11.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-jackson</artifactId>
|
||||
<version>0.11.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jdbc</artifactId>
|
||||
|
@ -38,8 +38,8 @@ public class CommentController {
|
||||
return commentService.findById(id).orElseThrow(() -> new NotFoundException("Comment not found"));
|
||||
}
|
||||
|
||||
@PostMapping("/posts/{id}")
|
||||
public ResponseEntity<Comment> addComment(@RequestBody Comment comment, Authentication authentication, @PathVariable("id") Long postId) {
|
||||
@PostMapping("/posts/{post-id}")
|
||||
public ResponseEntity<Comment> 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<Comment> listCommentsByPostId(@PathVariable("id") Long postId) {
|
||||
@GetMapping("/posts/{post-id}")
|
||||
public List<Comment> listCommentsByPostId(@PathVariable("post-id") Long postId) {
|
||||
postService.findById(postId).orElseThrow(() -> new NotFoundException("Post not found"));
|
||||
return commentService.getCommentsByCommentId(postId);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user