fix: the keyword and categoryId parameters of the post list api are required #1432 (#1436)

* fix: #1432

* doc: update CHANGELOG.md
pull/1438/head
Ryan Wang 2021-07-24 00:33:50 +08:00 committed by GitHub
parent dd8968fee7
commit 97941e37c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,11 @@
# CHANGELOG
# next
## Bug Fixes
- 修复 Content Api 中文章列表接口的 `keyword``categoryId` 参数为必传的问题。
# 1.4.10
## Features

View File

@ -72,15 +72,14 @@ public class PostController {
* @param pageable store the priority of the sort algorithm
* @param keyword search articles with keyword
* @param categoryId search articles with categoryId
* @return published articles that contains keywords and specific categoryid
* @return published articles that contains keywords and specific categoryId
*/
@GetMapping
@ApiOperation("Lists posts")
public Page<PostListVO> pageBy(
@PageableDefault(sort = {"topPriority", "createTime"}, direction = DESC) Pageable pageable,
@RequestParam(value = "keyword") String keyword,
@RequestParam(value = "categoryId") Integer categoryId) {
@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "categoryId", required = false) Integer categoryId) {
PostQuery postQuery = new PostQuery();
postQuery.setKeyword(keyword);
postQuery.setCategoryId(categoryId);