@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); }
@RequestMapping(value = "/comment", method = RequestMethod.POST) public ResponseEntity createComment(@RequestBody Comment comment) { commentService.addComment(comment.getPost().getId(), comment.getText()); return new ResponseEntity(HttpStatus.OK); }