Build basic controllers and services for backup and recovery

pull/146/head
johnniang 2019-04-26 10:52:05 +08:00
parent 72a2a0647b
commit e13e56f57b
9 changed files with 99 additions and 9 deletions

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -35,15 +35,10 @@ public class CommonController implements ErrorController {
private final ThemeService themeService;
private final OptionService optionService;
public CommonController(ThemeService themeService,
OptionService optionService) {
public CommonController(ThemeService themeService) {
this.themeService = themeService;
this.optionService = optionService;
}
/**
* Handle error
*
@ -109,7 +104,7 @@ public class CommonController implements ErrorController {
* @return String
*/
@GetMapping(value = "/404")
public String contentNotFround() throws FileNotFoundException {
public String contentNotFround() {
if (!themeService.isTemplateExist(NOT_FROUND_TEMPLATE)) {
return "common/error/404";
}

View File

@ -1,6 +1,5 @@
package run.halo.app.event.post;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@ -12,7 +11,6 @@ import run.halo.app.service.PostService;
* @author johnniang
* @date 19-4-22
*/
@Slf4j
@Component
public class PostVisitEventListener extends AbstractVisitEventListener {

View File

@ -2,6 +2,7 @@ package run.halo.app.event.post;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import run.halo.app.service.SheetService;
/**
@ -10,6 +11,7 @@ import run.halo.app.service.SheetService;
* @author johnniang
* @date 19-4-24
*/
@Component
public class SheetVisitEventListener extends AbstractVisitEventListener {
protected SheetVisitEventListener(SheetService sheetService) {

View File

@ -0,0 +1,10 @@
package run.halo.app.service;
/**
* Backup service interface.
*
* @author johnniang
* @date 19-4-26
*/
public interface BackupService {
}

View File

@ -0,0 +1,11 @@
package run.halo.app.service;
/**
* Recovery service interface.
*
* @author johnniang
* @date 19-4-26
*/
public interface RecoveryService {
}

View File

@ -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 {
}

View File

@ -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 {
}