Add CommentController

pull/137/head
johnniang 2019-03-19 19:45:51 +08:00
parent f117497331
commit 57965ba859
3 changed files with 35 additions and 2 deletions

View File

@ -0,0 +1,33 @@
package cc.ryanc.halo.web.controller.admin.api;
import cc.ryanc.halo.model.vo.CommentVO;
import cc.ryanc.halo.service.CommentService;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* Comment controller.
*
* @author johnniang
* @date 3/19/19
*/
@RestController
@RequestMapping("/admin/api/comments")
public class CommentController {
private final CommentService commentService;
public CommentController(CommentService commentService) {
this.commentService = commentService;
}
@GetMapping("latest")
@ApiOperation("Pages latest comments")
public Page<CommentVO> pageLatest(@RequestParam(name = "top", defaultValue = "10") int top) {
return commentService.pageLatest(top);
}
}

View File

@ -26,7 +26,7 @@ public class LogController {
}
@GetMapping("latest")
@ApiOperation("Page latest logs")
@ApiOperation("Pages latest logs")
public Page<LogOutputDTO> pageLatest(@RequestParam(name = "top", defaultValue = "10") int top) {
return logService.pageLatest(top);
}

View File

@ -26,7 +26,7 @@ public class PostController {
}
@GetMapping("latest")
@ApiOperation("Page latest post")
@ApiOperation("Pages latest post")
public Page<PostSimpleOutputDTO> pageLatest(@RequestParam(name = "top", defaultValue = "10") int top) {
return postService.pageLatest(top);
}