mirror of https://github.com/halo-dev/halo
Add LogController
parent
7898b777db
commit
f117497331
|
@ -72,7 +72,7 @@ public class SwaggerConfiguration {
|
||||||
log.debug("Doc disabled: [{}]", haloProperties.getDocDisabled());
|
log.debug("Doc disabled: [{}]", haloProperties.getDocDisabled());
|
||||||
return buildApiDocket("cc.ryanc.halo.admin",
|
return buildApiDocket("cc.ryanc.halo.admin",
|
||||||
"cc.ryanc.halo.web.controller.admin",
|
"cc.ryanc.halo.web.controller.admin",
|
||||||
"/api/admin/**")
|
"/admin/api/**")
|
||||||
.enable(!haloProperties.getDocDisabled());
|
.enable(!haloProperties.getDocDisabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package cc.ryanc.halo.web.controller.admin.api;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.model.dto.LogOutputDTO;
|
||||||
|
import cc.ryanc.halo.service.LogService;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log controller.
|
||||||
|
*
|
||||||
|
* @author johnniang
|
||||||
|
* @date 3/19/19
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/admin/api/logs")
|
||||||
|
public class LogController {
|
||||||
|
|
||||||
|
private final LogService logService;
|
||||||
|
|
||||||
|
public LogController(LogService logService) {
|
||||||
|
this.logService = logService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("latest")
|
||||||
|
@ApiOperation("Page latest logs")
|
||||||
|
public Page<LogOutputDTO> pageLatest(@RequestParam(name = "top", defaultValue = "10") int top) {
|
||||||
|
return logService.pageLatest(top);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package cc.ryanc.halo.web.controller.admin.api;
|
||||||
|
|
||||||
import cc.ryanc.halo.model.dto.post.PostSimpleOutputDTO;
|
import cc.ryanc.halo.model.dto.post.PostSimpleOutputDTO;
|
||||||
import cc.ryanc.halo.service.PostService;
|
import cc.ryanc.halo.service.PostService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -15,7 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
* @date 3/19/19
|
* @date 3/19/19
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/admin/posts")
|
@RequestMapping("/admin/api/posts")
|
||||||
public class PostController {
|
public class PostController {
|
||||||
|
|
||||||
private final PostService postService;
|
private final PostService postService;
|
||||||
|
@ -25,6 +26,7 @@ public class PostController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("latest")
|
@GetMapping("latest")
|
||||||
|
@ApiOperation("Page 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