Skip to content

Modify the content api to support list posts with new class PostQueryContent.#1373

Merged
ruibaby merged 5 commits into
halo-dev:masterfrom
Cui-Yusong:master
May 17, 2021
Merged

Modify the content api to support list posts with new class PostQueryContent.#1373
ruibaby merged 5 commits into
halo-dev:masterfrom
Cui-Yusong:master

Conversation

@Cui-Yusong

Copy link
Copy Markdown
Contributor

相比之前的版本,把remove去掉了,另外在model/params里新建了一个PostQueryContent类,这样文档上就不会显示status了。

@ruibaby

ruibaby commented May 16, 2021

Copy link
Copy Markdown
Member

感觉这样做不太好,还不如直接把 keyword 和 categoryId 当做参数。

你要修改的话,直接在这个分支 push commit 就行了,不用重新开 pr。

@Cui-Yusong

Copy link
Copy Markdown
Contributor Author

好的,我再尝试下,谢谢!

Page<Post> postPage = postService.pageBy(PostStatus.PUBLISHED, pageable);
return postService.convertToListVo(postPage);
@PageableDefault(sort = {"topPriority", "createTime"}, direction = DESC) Pageable pageable,
@RequestParam(value = "keyword") String keyword) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好像没有 categoryId

PostStatus status = PostStatus.PUBLISHED;
PostQuery postQuery=new PostQuery();
postQuery.setKeyword(keyword);
postQuery.setStatus(status);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接 postQuery.setStatue(PostStatus.PUBLISHED) 就好了。

@ruibaby ruibaby requested a review from JohnNiang May 16, 2021 09:15
@Cui-Yusong

Copy link
Copy Markdown
Contributor Author

修改好了,添加了categoryid,简化了代码。

@ruibaby

ruibaby commented May 17, 2021

Copy link
Copy Markdown
Member

需要处理一下 checkstyle 异常。

https://github.com/halo-dev/halo/pull/1373/checks?check_run_id=2596554135

@1171-jpg

Copy link
Copy Markdown

收到,我修改下!

@JohnNiang JohnNiang changed the title Modefy the content api to support list posts with new class PostQueryContent. Modify the content api to support list posts with new class PostQueryContent. May 17, 2021
@1171-jpg

Copy link
Copy Markdown

修改了checkstyle,然后那个title我最后其实放弃了用新的类的思路,直接通过requestparams去获取参数了。

@ruibaby

ruibaby commented May 17, 2021

Copy link
Copy Markdown
Member

修改了checkstyle,然后那个title我最后其实放弃了用新的类的思路,直接通过requestparams去获取参数了。

什么 title

@1171-jpg

Copy link
Copy Markdown

哦哦,就是我怕这个pr的名字有误导性--Modify the content api to support list posts with new class PostQueryContent. 因为我后来没有采用这个引入新类的方法了

@ruibaby ruibaby merged commit 4c68ae9 into halo-dev:master May 17, 2021
@ruibaby

ruibaby commented May 17, 2021

Copy link
Copy Markdown
Member

@Cui-Yusong @1171-jpg 同一个人?

@1171-jpg

Copy link
Copy Markdown

啊不是,代码是我写的,提交时用的@Cui-Yusong 的账号,造成困扰了,不好意思哈

ruibaby pushed a commit to ruibaby/halo that referenced this pull request Jun 11, 2021
…ategory params. (halo-dev#1373)

* Modefy the content api to support list posts with new class PostQueryContent

* Modefy the content api to support list posts with new class PostQueryContent

* using parameters

* with categoryid

* checkstyle

Co-authored-by: Cui <11811305@mail.sustech.edu.cn>
@ruibaby ruibaby linked an issue Jun 12, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Content API: Lists posts by category slug with keyword support.

3 participants