|
@@ -54,44 +54,4 @@ public class PostController {
|
54
|
54
|
return postService.deletePost(postId);
|
55
|
55
|
}
|
56
|
56
|
|
57
|
|
-// @PutMapping("/users/{userId/posts")
|
58
|
|
-// public ResponseEntity<Post> updatePost(@PathVariable Long userId, @RequestBody Post post){
|
59
|
|
-// return postService.updatePost(userId, post);
|
60
|
|
-// }
|
61
|
|
-
|
62
|
|
-
|
63
|
|
-
|
64
|
|
-// @PutMapping("/users/{userId}/posts/{postId}")
|
65
|
|
-// public Post updateComment(@PathVariable (value = "userId") Long userId,
|
66
|
|
-// @PathVariable (value = "postId") Long postId,
|
67
|
|
-// @Valid @RequestBody Post postRequest) {
|
68
|
|
-// if(!userRepository.existsById(userId)) {
|
69
|
|
-// throw new ResourceNotFoundException("UserId " + userId + " not found");
|
70
|
|
-// }
|
71
|
|
-//
|
72
|
|
-// return postRepository.findById(postId).map(post -> {
|
73
|
|
-// post.setMessage(postRequest.getMessage());
|
74
|
|
-// return postRepository.save(post);
|
75
|
|
-// }).orElseThrow(() -> new ResourceNotFoundException("PostId " + postId + "not found"));
|
76
|
|
-// }
|
77
|
|
-//
|
78
|
|
-// @DeleteMapping("/posts/{postId}/comments/{commentId}")
|
79
|
|
-// public ResponseEntity<?> deleteComment(@PathVariable (value = "userId") Long userId,
|
80
|
|
-// @PathVariable (value = "postId") Long postId) {
|
81
|
|
-// if(!userRepository.existsById(userId)) {
|
82
|
|
-// throw new ResourceNotFoundException("UserId " + userId + " not found");
|
83
|
|
-// }
|
84
|
|
-//
|
85
|
|
-// return postRepository.findById(postId).map(post -> {
|
86
|
|
-// postRepository.delete(post);
|
87
|
|
-// return ResponseEntity.ok().build();
|
88
|
|
-// }).orElseThrow(() -> new ResourceNotFoundException("PostId " + postId + " not found"));
|
89
|
|
-// }
|
90
|
57
|
}
|
91
|
|
-
|
92
|
|
-
|
93
|
|
-// @PutMapping("/{userId}/posts")
|
94
|
|
-// public ResponseEntity<?> addPost(@PathVariable Long userId, @RequestBody String message){
|
95
|
|
-// Post post = new Post(message, userId);
|
96
|
|
-// return userService.addpost(userId, post);
|
97
|
|
-// }
|