mirror of https://github.com/halo-dev/halo
Add CommentController
parent
f117497331
commit
57965ba859
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,7 +26,7 @@ public class LogController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("latest")
|
@GetMapping("latest")
|
||||||
@ApiOperation("Page latest logs")
|
@ApiOperation("Pages latest logs")
|
||||||
public Page<LogOutputDTO> pageLatest(@RequestParam(name = "top", defaultValue = "10") int top) {
|
public Page<LogOutputDTO> pageLatest(@RequestParam(name = "top", defaultValue = "10") int top) {
|
||||||
return logService.pageLatest(top);
|
return logService.pageLatest(top);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class PostController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("latest")
|
@GetMapping("latest")
|
||||||
@ApiOperation("Page latest post")
|
@ApiOperation("Pages latest post")
|
||||||
public Page<PostSimpleOutputDTO> pageLatest(@RequestParam(name = "top", defaultValue = "10") int top) {
|
public Page<PostSimpleOutputDTO> pageLatest(@RequestParam(name = "top", defaultValue = "10") int top) {
|
||||||
return postService.pageLatest(top);
|
return postService.pageLatest(top);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue