新增类别接口
This commit is contained in:
@@ -2,8 +2,10 @@ package la.moony.douban;
|
||||
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import la.moony.douban.extension.DoubanMovie;
|
||||
import la.moony.douban.finders.DoubanFinder;
|
||||
import la.moony.douban.service.DoubanService;
|
||||
import la.moony.douban.vo.DoubanMovieVo;
|
||||
import la.moony.douban.vo.DoubanTypeVo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springdoc.webflux.core.fn.SpringdocRouteBuilder;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -25,9 +27,12 @@ public class DoubanEndpoint implements CustomEndpoint {
|
||||
|
||||
private final DoubanService doubanService;
|
||||
|
||||
private final DoubanFinder doubanFinder;
|
||||
|
||||
public DoubanEndpoint(DoubanService doubanService) {
|
||||
|
||||
public DoubanEndpoint(DoubanService doubanService, DoubanFinder doubanFinder) {
|
||||
this.doubanService = doubanService;
|
||||
this.doubanFinder = doubanFinder;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,6 +48,13 @@ public class DoubanEndpoint implements CustomEndpoint {
|
||||
);
|
||||
DoubanMovieQuery.buildParameters(builder);
|
||||
})
|
||||
.GET("doubanmovies/-/types", this::ListTypes,
|
||||
builder -> builder.operationId("ListTypes")
|
||||
.description("List all douban types.")
|
||||
.tag(doubanMovieTag)
|
||||
.response(responseBuilder()
|
||||
.implementationArray(DoubanTypeVo.class)
|
||||
))
|
||||
.GET("doubanmovies/-/genres", this::ListGenres,
|
||||
builder -> builder.operationId("ListGenres")
|
||||
.description("List all douban genres.")
|
||||
@@ -87,6 +99,12 @@ public class DoubanEndpoint implements CustomEndpoint {
|
||||
.flatMap(result -> ServerResponse.ok().bodyValue(result));
|
||||
}
|
||||
|
||||
private Mono<ServerResponse> ListTypes(ServerRequest request) {
|
||||
return doubanFinder.listAllType()
|
||||
.collectList()
|
||||
.flatMap(result -> ServerResponse.ok().bodyValue(result));
|
||||
}
|
||||
|
||||
private Mono<ServerResponse> getDoubanDetail(ServerRequest request) {
|
||||
String url = request.queryParam("url").orElse(null);
|
||||
return doubanService.getDoubanDetail(url)
|
||||
|
||||
@@ -10,7 +10,7 @@ metadata:
|
||||
rbac.authorization.halo.run/display-name: "查看朋友圈提交模板"
|
||||
rules:
|
||||
- apiGroups: [ "api.douban.moony.la" ]
|
||||
resources: [ "doubanmovies","doubanmovies/genres","doubanmovies/getDoubanDetail"]
|
||||
resources: [ "doubanmovies","doubanmovies/types","doubanmovies/genres","doubanmovies/getDoubanDetail"]
|
||||
verbs: [ "get", "list" ]
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user