Skip to content

Commit

Permalink
fix: 필터링 쿼리가 null일 경우 빈 값으로 치환하도록 수정 (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
donghoony committed Aug 17, 2023
1 parent 89dbd6e commit 4afa356
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,16 @@ public class ModifiedFeedFilterDto {
public static ModifiedFeedFilterDto from(FeedFilterDto dto){
ModifiedFeedFilterDto modifiedDto = new ModifiedFeedFilterDto();

modifiedDto.queryType = dto.getQuery().startsWith("@") ? QueryType.AUTHOR_NAME : QueryType.TITLE;
modifiedDto.query = dto.getQuery();
modifiedDto.query = dto.getQuery() == null ? "" : dto.getQuery();

if (modifiedDto.getQuery().startsWith("@")){
modifiedDto.queryType = QueryType.AUTHOR_NAME;
modifiedDto.query = modifiedDto.query.substring(1);
}
else{
modifiedDto.queryType = QueryType.TITLE;
}

modifiedDto.filterType = FilterType.from(dto.getFilterType());
modifiedDto.difficulties = dto.getDifficulty() == null ? List.of(Difficulty.EASY, Difficulty.NORMAL, Difficulty.HARD)
: List.of(Difficulty.from(dto.getDifficulty()));
Expand Down

0 comments on commit 4afa356

Please sign in to comment.