mirror of https://github.com/halo-dev/halo
Refactor migrate api.
parent
bf1bea2e97
commit
13c120b815
|
@ -36,4 +36,10 @@ public class MigrateController {
|
||||||
public void migrateWordPress(@RequestPart("file") MultipartFile file) {
|
public void migrateWordPress(@RequestPart("file") MultipartFile file) {
|
||||||
migrateService.migrate(file, MigrateType.WORDPRESS);
|
migrateService.migrate(file, MigrateType.WORDPRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("cnblogs")
|
||||||
|
@ApiOperation("Migrate from cnblogs")
|
||||||
|
public void migrateCnBlogs(@RequestPart("file") MultipartFile file) {
|
||||||
|
migrateService.migrate(file, MigrateType.CNBLOGS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,7 +16,12 @@ public enum MigrateType implements ValueEnum<Integer> {
|
||||||
/**
|
/**
|
||||||
* WordPress
|
* WordPress
|
||||||
*/
|
*/
|
||||||
WORDPRESS(1);
|
WORDPRESS(1),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cnblogs.com
|
||||||
|
*/
|
||||||
|
CNBLOGS(2);
|
||||||
|
|
||||||
private Integer value;
|
private Integer value;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue