Skip to content

Commit 24eb3d8

Browse files
committed
updated api for stories
1 parent 36fdfa7 commit 24eb3d8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

server/src/main/java/voldemort/writter/server/rest/StoryController.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,24 @@ public ResponseEntity<Story> getStory(@PathVariable() Long storyId) {
5050
}
5151

5252
@GetMapping("/user")
53-
public ResponseEntity<List<Story>> getStoryByUser() {
53+
public ResponseEntity<List<Story>> getStoriesForUser() {
5454
User user = AuthenticationUtils.getCurrentUser();
5555
return new ResponseEntity<List<Story>>(storyDao.findByUser(user), HttpStatus.OK);
5656
}
5757

5858
@GetMapping("/user/{userId}")
59-
public ResponseEntity<List<Story>> getStoryByUser(@PathVariable() Long userId) {
59+
public ResponseEntity<List<Story>> getStoriesByUser(@PathVariable() Long userId) {
6060
return new ResponseEntity<List<Story>>(storyDao.findByUser(new User(userId)), HttpStatus.OK);
6161
}
6262

63+
@GetMapping("/recommended")
64+
public ResponseEntity<List<Story>> getRecommendedStories() {
65+
User user = AuthenticationUtils.getCurrentUser();
66+
return new ResponseEntity<>(recommendationDao.findAllRecommended(new User(user.getId())), HttpStatus.OK);
67+
}
68+
6369
@GetMapping("/recommended/{userId}")
64-
public ResponseEntity<List<Story>> getRecommendedStory(@PathVariable() Long userId) {
70+
public ResponseEntity<List<Story>> getRecommendedStories(@PathVariable() Long userId) {
6571
return new ResponseEntity<>(recommendationDao.findAllRecommended(new User(userId)), HttpStatus.OK);
6672
}
6773

0 commit comments

Comments
 (0)