Skip to content

Commit

Permalink
Merge pull request #204 from kakao-tech-campus-2nd-step3/refactor/#172-…
Browse files Browse the repository at this point in the history
…PlaceDetailInfo

[fix]: Category Enum명으로 api 호출이 가능하도록 수정했습니다.
  • Loading branch information
sanghee0820 authored Nov 14, 2024
2 parents 3050181 + e1e1b87 commit 94f9003
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import team7.inplace.place.application.dto.LikedPlaceInfo;
import team7.inplace.place.application.dto.PlaceDetailInfo;
import team7.inplace.place.application.dto.PlaceInfo;
import team7.inplace.place.domain.Category;
import team7.inplace.place.domain.Place;
import team7.inplace.place.persistence.PlaceRepository;
import team7.inplace.placeMessage.application.command.PlaceMessageCommand;
Expand Down Expand Up @@ -55,7 +56,10 @@ public Page<PlaceInfo> getPlacesWithinRadius(

// categories와 influencers 필터 처리
List<String> categoryFilters = placesFilterParamsCommand.isCategoryFilterExists()
? Arrays.stream(placesFilterParamsCommand.categories().split(",")).toList()
? Arrays.stream(placesFilterParamsCommand.categories().split(","))
.map(Category::of)
.map(Category::name)
.toList()
: null;

List<String> influencerFilters = placesFilterParamsCommand.isInfluencerFilterExists()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/team7/inplace/place/domain/Category.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public enum Category {

public static Category of(String name) {
for (Category category : values()) {
if (category.name.equals(name)) {
if (category.name.equalsIgnoreCase(name) || category.name().equalsIgnoreCase(name)) {
return category;
}
}
Expand Down

0 comments on commit 94f9003

Please sign in to comment.