Skip to content

Commit

Permalink
Merge pull request #18 from kusitms-28th-Meetup-E/feat/community
Browse files Browse the repository at this point in the history
feat : 커뮤니티 검색 수정
  • Loading branch information
seungueonn authored Nov 23, 2023
2 parents 3ff31f3 + 8f5b90f commit a50606f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
@Getter
@RequiredArgsConstructor
public enum CommunityOrderCondition {
TOPIC("topic"),ISSUE("issue"), KEYWORD("keyword"),ALL("all");
TOPIC("topic"),ISSUE("issue"), KEYWORD("keyword"),ALL("all"),SEARCH("search");
private final String name;
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ private BooleanExpression orderByColumn(CommunityOrderCondition orderCondition,
return community.issue.eq(word);
} else if (orderCondition.equals(CommunityOrderCondition.ALL)) {
return null;
} else if (orderCondition.equals(CommunityOrderCondition.SEARCH)) {
return community.topic.like("%"+word+"%").or(community.issue.like("%"+word+"%")
.or(community.keyword.like("%"+word+"%").or(community.talk.like("%"+word+"%"))));
} else{
return community.topic.eq(word);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ public List<CommunityRes> getAllCommunity(String memberId) {
communityRes.stream().forEach(
communityRes1 ->
{

String writerId = communityRes1.getWriterId();
MemberDto memberDto = findMemberFeignClient.getMemberBySocialId(writerId);
communityRes1.updateMemberDto(memberDto);


Long contentsId = communityRes1.getContentsId();
ContentsDto contentsDto = findContentsFeignClient.getContents(contentsId).getBody().getData();
communityRes1.updateContentsDto(contentsDto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ public ResponseEntity<SuccessResponse<List<CommunityRes>>> getMyCommunity(@Reque
}


@GetMapping("/search/{sortBy}/{keyword}")
public ResponseEntity<SuccessResponse<SearchRes>> search(@RequestHeader(value = "user-id") String socialId, @PathVariable("sortBy") String sortBy, @PathVariable String keyword) {
return ResponseEntity.ok(SuccessResponse.create(CommunityResponseMessage.GET_COMMUNITY_SUCCESS.getMessage(),this.communityReadUseCase.getSearchList(socialId ,sortBy,keyword)));
@GetMapping("/search/{word}")
public ResponseEntity<SuccessResponse<SearchRes>> search(@RequestHeader(value = "user-id") String socialId, @PathVariable("word") String word) {
return ResponseEntity.ok(SuccessResponse.create(CommunityResponseMessage.GET_COMMUNITY_SUCCESS.getMessage(),this.communityReadUseCase.getSearchList(socialId ,"SEARCH",word)));
}



}


0 comments on commit a50606f

Please sign in to comment.