Skip to content

Commit

Permalink
refactor: remove unused query params for post
Browse files Browse the repository at this point in the history
  • Loading branch information
guqing committed Jan 23, 2024
1 parent 66eb97f commit d30d300
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions application/src/main/java/run/halo/app/content/PostQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.domain.Sort;
Expand Down Expand Up @@ -49,36 +47,12 @@ public String getUsername() {
return username;
}

@Nullable
@Schema(name = "contributor")
public Set<String> getContributors() {
return listToSet(queryParams.get("contributor"));
}

@Nullable
@Schema(name = "category")
public Set<String> getCategories() {
return listToSet(queryParams.get("category"));
}

@Nullable
@Schema(name = "tag")
public Set<String> getTags() {
return listToSet(queryParams.get("tag"));
}

@Nullable
public Post.PostPhase getPublishPhase() {
String publishPhase = queryParams.getFirst("publishPhase");
return Post.PostPhase.from(publishPhase);
}

@Nullable
public Post.VisibleEnum getVisible() {
String visible = queryParams.getFirst("visible");
return Post.VisibleEnum.from(visible);
}

@Nullable
@Schema(description = "Posts filtered by keyword.")
public String getKeyword() {
Expand All @@ -96,11 +70,6 @@ public Sort getSort() {
return SortResolver.defaultInstance.resolve(exchange);
}

@Nullable
private Set<String> listToSet(List<String> param) {
return param == null ? null : Set.copyOf(param);
}

/**
* Build a list options from the query object.
*
Expand Down Expand Up @@ -138,13 +107,6 @@ public ListOptions toListOptions() {
}
}

Post.VisibleEnum visible = getVisible();
if (visible != null) {
fieldQuery = QueryFactory.and(fieldQuery, QueryFactory.equal(
"spec.visible", visible.name())
);
}

if (StringUtils.isNotBlank(username)) {
fieldQuery = QueryFactory.and(fieldQuery, QueryFactory.equal(
"spec.owner", username)
Expand Down

0 comments on commit d30d300

Please sign in to comment.