mirror of https://github.com/halo-dev/halo
Complete delete comment api
parent
6b0dc1ce5e
commit
836e9975e8
|
@ -71,12 +71,22 @@ public class CommentController {
|
|||
|
||||
@PutMapping("{commentId:\\d+}/status/{status}")
|
||||
@ApiOperation("Update comment status")
|
||||
public CommentOutputDTO deleteBy(@PathVariable("commentId") Long commentId,
|
||||
@PathVariable("status") CommentStatus status) {
|
||||
public CommentOutputDTO updateStatusBy(@PathVariable("commentId") Long commentId,
|
||||
@PathVariable("status") CommentStatus status) {
|
||||
// Update comment status
|
||||
Comment updatedComment = commentService.updateStatus(commentId, status);
|
||||
|
||||
return new CommentOutputDTO().convertFrom(updatedComment);
|
||||
}
|
||||
|
||||
@DeleteMapping("{commentId:\\d+}")
|
||||
public CommentOutputDTO deleteBy(@PathVariable("commentId") Long commentId) {
|
||||
// Get comment by id
|
||||
Comment comment = commentService.getById(commentId);
|
||||
|
||||
// Remove it
|
||||
commentService.remove(comment);
|
||||
|
||||
return new CommentOutputDTO().convertFrom(comment);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue