diff --git a/src/main/java/run/halo/app/controller/content/api/CategoryController.java b/src/main/java/run/halo/app/controller/content/api/CategoryController.java index 7f64b9421f..90b3189f44 100644 --- a/src/main/java/run/halo/app/controller/content/api/CategoryController.java +++ b/src/main/java/run/halo/app/controller/content/api/CategoryController.java @@ -8,10 +8,10 @@ import org.springframework.data.web.SortDefault; import org.springframework.web.bind.annotation.*; import run.halo.app.model.dto.CategoryDTO; -import run.halo.app.model.dto.post.BasePostSimpleDTO; import run.halo.app.model.entity.Category; import run.halo.app.model.entity.Post; import run.halo.app.model.enums.PostStatus; +import run.halo.app.model.vo.PostListVO; import run.halo.app.service.CategoryService; import run.halo.app.service.PostCategoryService; import run.halo.app.service.PostService; @@ -56,12 +56,12 @@ public List listCategories(@SortDefault(sort = "updateTim @GetMapping("{slug}/posts") @ApiOperation("Lists posts by category slug") - public Page listPostsBy(@PathVariable("slug") String slug, + public Page listPostsBy(@PathVariable("slug") String slug, @PageableDefault(sort = {"topPriority", "updateTime"}, direction = DESC) Pageable pageable) { // Get category by slug Category category = categoryService.getBySlugOfNonNull(slug); Page postPage = postCategoryService.pagePostBy(category.getId(), PostStatus.PUBLISHED, pageable); - return postService.convertToSimple(postPage); + return postService.convertToListVo(postPage); } } diff --git a/src/main/java/run/halo/app/controller/content/api/TagController.java b/src/main/java/run/halo/app/controller/content/api/TagController.java index d44cccfbce..f6ac35ee28 100644 --- a/src/main/java/run/halo/app/controller/content/api/TagController.java +++ b/src/main/java/run/halo/app/controller/content/api/TagController.java @@ -9,10 +9,10 @@ import org.springframework.data.web.SortDefault; import org.springframework.web.bind.annotation.*; import run.halo.app.model.dto.TagDTO; -import run.halo.app.model.dto.post.BasePostSimpleDTO; import run.halo.app.model.entity.Post; import run.halo.app.model.entity.Tag; import run.halo.app.model.enums.PostStatus; +import run.halo.app.model.vo.PostListVO; import run.halo.app.service.PostService; import run.halo.app.service.PostTagService; import run.halo.app.service.TagService; @@ -59,13 +59,13 @@ public List listTags(@SortDefault(sort = "updateTime", directi @GetMapping("{slug}/posts") @ApiOperation("Lists posts by tag slug") - public Page listPostsBy(@PathVariable("slug") String slug, + public Page listPostsBy(@PathVariable("slug") String slug, @PageableDefault(sort = {"topPriority", "updateTime"}, direction = DESC) Pageable pageable) { // Get tag by slug Tag tag = tagService.getBySlugOfNonNull(slug); // Get posts, convert and return Page postPage = postTagService.pagePostsBy(tag.getId(), PostStatus.PUBLISHED, pageable); - return postService.convertToSimple(postPage); + return postService.convertToListVo(postPage); } }