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>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jdbc</artifactId>
|
<artifactId>spring-boot-starter-data-jdbc</artifactId>
|
||||||
|
@ -38,8 +38,8 @@ public class CommentController {
|
|||||||
return commentService.findById(id).orElseThrow(() -> new NotFoundException("Comment not found"));
|
return commentService.findById(id).orElseThrow(() -> new NotFoundException("Comment not found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/posts/{id}")
|
@PostMapping("/posts/{post-id}")
|
||||||
public ResponseEntity<Comment> addComment(@RequestBody Comment comment, Authentication authentication, @PathVariable("id") Long postId) {
|
public ResponseEntity<Comment> addComment(@RequestBody Comment comment, Authentication authentication, @PathVariable("post-id") Long postId) {
|
||||||
if (authentication == null || !authentication.isAuthenticated()) {
|
if (authentication == null || !authentication.isAuthenticated()) {
|
||||||
throw new ForbiddenExecption("You are not authorized to access this resource");
|
throw new ForbiddenExecption("You are not authorized to access this resource");
|
||||||
}
|
}
|
||||||
@ -54,8 +54,8 @@ public class CommentController {
|
|||||||
return new ResponseEntity<>(insertedComment, HttpStatus.CREATED);
|
return new ResponseEntity<>(insertedComment, HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/posts/{id}")
|
@GetMapping("/posts/{post-id}")
|
||||||
public List<Comment> listCommentsByPostId(@PathVariable("id") Long postId) {
|
public List<Comment> listCommentsByPostId(@PathVariable("post-id") Long postId) {
|
||||||
postService.findById(postId).orElseThrow(() -> new NotFoundException("Post not found"));
|
postService.findById(postId).orElseThrow(() -> new NotFoundException("Post not found"));
|
||||||
return commentService.getCommentsByCommentId(postId);
|
return commentService.getCommentsByCommentId(postId);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user