mirror of https://github.com/halo-dev/halo
Build basic controllers and services for backup and recovery
parent
72a2a0647b
commit
e13e56f57b
|
@ -0,0 +1,22 @@
|
||||||
|
package run.halo.app.controller.admin.api;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import run.halo.app.service.BackupService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Backup controller
|
||||||
|
*
|
||||||
|
* @author johnniang
|
||||||
|
* @date 19-4-26
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/admin/backups")
|
||||||
|
public class BackupController {
|
||||||
|
|
||||||
|
private final BackupService backupService;
|
||||||
|
|
||||||
|
public BackupController(BackupService backupService) {
|
||||||
|
this.backupService = backupService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package run.halo.app.controller.admin.api;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import run.halo.app.service.RecoveryService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recovery controller
|
||||||
|
*
|
||||||
|
* @author johnniang
|
||||||
|
* @date 19-4-26
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/admin/recoveries")
|
||||||
|
public class RecoveryController {
|
||||||
|
|
||||||
|
private final RecoveryService recoveryService;
|
||||||
|
|
||||||
|
public RecoveryController(RecoveryService recoveryService) {
|
||||||
|
this.recoveryService = recoveryService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,15 +35,10 @@ public class CommonController implements ErrorController {
|
||||||
|
|
||||||
private final ThemeService themeService;
|
private final ThemeService themeService;
|
||||||
|
|
||||||
private final OptionService optionService;
|
public CommonController(ThemeService themeService) {
|
||||||
|
|
||||||
public CommonController(ThemeService themeService,
|
|
||||||
OptionService optionService) {
|
|
||||||
this.themeService = themeService;
|
this.themeService = themeService;
|
||||||
this.optionService = optionService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle error
|
* Handle error
|
||||||
*
|
*
|
||||||
|
@ -109,7 +104,7 @@ public class CommonController implements ErrorController {
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/404")
|
@GetMapping(value = "/404")
|
||||||
public String contentNotFround() throws FileNotFoundException {
|
public String contentNotFround() {
|
||||||
if (!themeService.isTemplateExist(NOT_FROUND_TEMPLATE)) {
|
if (!themeService.isTemplateExist(NOT_FROUND_TEMPLATE)) {
|
||||||
return "common/error/404";
|
return "common/error/404";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package run.halo.app.event.post;
|
package run.halo.app.event.post;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -12,7 +11,6 @@ import run.halo.app.service.PostService;
|
||||||
* @author johnniang
|
* @author johnniang
|
||||||
* @date 19-4-22
|
* @date 19-4-22
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
|
||||||
@Component
|
@Component
|
||||||
public class PostVisitEventListener extends AbstractVisitEventListener {
|
public class PostVisitEventListener extends AbstractVisitEventListener {
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package run.halo.app.event.post;
|
||||||
|
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
import run.halo.app.service.SheetService;
|
import run.halo.app.service.SheetService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,6 +11,7 @@ import run.halo.app.service.SheetService;
|
||||||
* @author johnniang
|
* @author johnniang
|
||||||
* @date 19-4-24
|
* @date 19-4-24
|
||||||
*/
|
*/
|
||||||
|
@Component
|
||||||
public class SheetVisitEventListener extends AbstractVisitEventListener {
|
public class SheetVisitEventListener extends AbstractVisitEventListener {
|
||||||
|
|
||||||
protected SheetVisitEventListener(SheetService sheetService) {
|
protected SheetVisitEventListener(SheetService sheetService) {
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package run.halo.app.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Backup service interface.
|
||||||
|
*
|
||||||
|
* @author johnniang
|
||||||
|
* @date 19-4-26
|
||||||
|
*/
|
||||||
|
public interface BackupService {
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package run.halo.app.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recovery service interface.
|
||||||
|
*
|
||||||
|
* @author johnniang
|
||||||
|
* @date 19-4-26
|
||||||
|
*/
|
||||||
|
public interface RecoveryService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package run.halo.app.service.impl;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import run.halo.app.service.BackupService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Backup service implementation.
|
||||||
|
*
|
||||||
|
* @author johnniang
|
||||||
|
* @date 19-4-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BackupServiceImpl implements BackupService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package run.halo.app.service.impl;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import run.halo.app.service.RecoveryService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recovery service implementation.
|
||||||
|
*
|
||||||
|
* @author johnniang
|
||||||
|
* @date 19-4-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class RecoveryServiceImpl implements RecoveryService {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue