refactor: theme list data conversion (#2592)

#### What type of PR is this?
/kind bug
/area core
/milestone 2.0

#### What this PR does / why we need it:
修复主题列表数据类型转换问题
#### Which issue(s) this PR fixes:

Fixes #

#### Special notes for your reviewer:
how to test it?
访问如下 API 不报错即可
```
curl http://localhost:8090/apis/api.console.halo.run/v1alpha1/themes?uninstalled=false
```

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/2593/head
guqing 2022-10-18 14:34:09 +08:00 committed by GitHub
parent 299634b756
commit 9d67ce60cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -310,6 +310,7 @@ public class ThemeEndpoint implements CustomEndpoint {
return walkThemesFromPath(themesDir)
.filter(Files::isDirectory)
.map(themePath -> loadUnstructured(themePath, THEME_MANIFESTS))
.flatMap(Flux::fromIterable)
.map(unstructured -> Unstructured.OBJECT_MAPPER.convertValue(unstructured,
Theme.class))
.sort(Comparator.comparing(theme -> theme.getMetadata().getName()));