Class ContentViewController
- java.lang.Object
-
- in.cs699.tensors.delagram.content_view_service.controller.ContentViewController
-
@RestController @RequestMapping("/view-api") @CrossOrigin("http://localhost:3000") public class ContentViewController extends Object
This controller defines an end-point to fetch the feed for the user, features that let a user interact with a memory - react, comment and report.- Author:
- swaroop_nath
-
-
Constructor Summary
Constructors Constructor Description ContentViewController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
commentOnMemory(String authorizationToken, Map<String,Object> payload)
The end-point that allows users to comment on a memory in the feed.List<Feed>
fetchFeed(String authorizationToken, Map<String,Object> payload)
The end-point that provides the web-service of fetching the recent feed for the currently logged in user.void
reactOnMemory(String authorizationToken, Map<String,Object> payload)
The end-point that allows users to add a star to a memory in the feed.void
reportMemory(String authorizationToken, Map<String,Object> payload)
The end-point that lets users report a memory on their feed.
-
-
-
Method Detail
-
fetchFeed
@PostMapping(value="/fetch-feed", produces="application/json") public List<Feed> fetchFeed(@RequestHeader("authorization") String authorizationToken, @RequestBody Map<String,Object> payload) throws AuthorizationFailedException, AuthenticationFailedException, InternalServerException, FeedLoadFailedException
The end-point that provides the web-service of fetching the recent feed for the currently logged in user.- Parameters:
authorizationToken
- The firebase token/JWT that identifies the user.payload
- The payload with the request. It must include the id of the currently logged in user.- Returns:
- Returns the list of recently uploaded memories.
- Throws:
AuthorizationFailedException
- Thrown in case the JWT doesn't represent the said user.AuthenticationFailedException
- Thrown in case JWT isn't valid.InternalServerException
- Thrown in case there is any internal server error.FeedLoadFailedException
- Thrown in case the feed couldn't be loaded for the user.
-
reactOnMemory
@PostMapping("/react-on-memory") public void reactOnMemory(@RequestHeader("authorization") String authorizationToken, @RequestBody Map<String,Object> payload) throws AuthorizationFailedException, AuthenticationFailedException, InternalServerException
The end-point that allows users to add a star to a memory in the feed.- Parameters:
authorizationToken
- The firebase token/JWT that identifies the user.payload
- The payload with the request.- Throws:
AuthorizationFailedException
- Thrown in case the JWT doesn't represent the said user.AuthenticationFailedException
- Thrown in case JWT isn't valid.InternalServerException
- Thrown in case there is any internal server error.
-
commentOnMemory
@PostMapping("/comment-on-memory") public void commentOnMemory(@RequestHeader("authorization") String authorizationToken, @RequestBody Map<String,Object> payload) throws AuthorizationFailedException, AuthenticationFailedException, InternalServerException
The end-point that allows users to comment on a memory in the feed.- Parameters:
authorizationToken
- The firebase token/JWT that identifies the user.payload
- The payload with the request.- Throws:
AuthorizationFailedException
- Thrown in case the JWT doesn't represent the said user.AuthenticationFailedException
- Thrown in case JWT isn't valid.InternalServerException
- Thrown in case there is any internal server error.
-
reportMemory
@PostMapping("/report-memory") public void reportMemory(@RequestHeader("authorization") String authorizationToken, @RequestBody Map<String,Object> payload) throws AuthorizationFailedException, AuthenticationFailedException
The end-point that lets users report a memory on their feed.- Parameters:
authorizationToken
- The firebase token/JWT that identifies the user.payload
- The payload with the request.- Throws:
AuthorizationFailedException
- Thrown in case the JWT doesn't represent the said user.AuthenticationFailedException
- Thrown in case JWT isn't valid.
-
-