Refactor migrate api.

pull/376/head
ruibaby 2019-10-30 16:07:01 +08:00
parent bf1bea2e97
commit 13c120b815
3 changed files with 35 additions and 1 deletions

View File

@ -36,4 +36,10 @@ public class MigrateController {
public void migrateWordPress(@RequestPart("file") MultipartFile file) {
migrateService.migrate(file, MigrateType.WORDPRESS);
}
@PostMapping("cnblogs")
@ApiOperation("Migrate from cnblogs")
public void migrateCnBlogs(@RequestPart("file") MultipartFile file) {
migrateService.migrate(file, MigrateType.CNBLOGS);
}
}

View File

@ -0,0 +1,23 @@
package run.halo.app.handler.migrate;
import org.springframework.web.multipart.MultipartFile;
import run.halo.app.model.enums.MigrateType;
/**
* Cnblogs(https://cnblogs.com) migrate handler.
*
* @author ryanwang
* @date 2019-10-30
*/
public class CnBlogsMigrateHandler implements MigrateHandler {
@Override
public void migrate(MultipartFile file) {
// TODO
}
@Override
public boolean supportType(MigrateType type) {
return MigrateType.CNBLOGS.equals(type);
}
}

View File

@ -16,7 +16,12 @@ public enum MigrateType implements ValueEnum<Integer> {
/**
* WordPress
*/
WORDPRESS(1);
WORDPRESS(1),
/**
* cnblogs.com
*/
CNBLOGS(2);
private Integer value;