Ejemplo n.º 1
0
 @RequestMapping(value = "/remove_comment", method = RequestMethod.POST)
 public ResponseEntity removeComment(@RequestBody Long commentId) {
   if (commentService.findComment(commentId).getAuthor().getId() == User.getCurrentUserId())
     commentService.removeComment(commentId);
   return new ResponseEntity(HttpStatus.OK);
 }
Ejemplo n.º 2
0
 @RequestMapping(value = "/comment", method = RequestMethod.POST)
 public ResponseEntity createComment(@RequestBody Comment comment) {
   commentService.addComment(comment.getPost().getId(), comment.getText());
   return new ResponseEntity(HttpStatus.OK);
 }