Skip to content

Commit

Permalink
M3-129 Feat : 리퀘스트 요청 수용2
Browse files Browse the repository at this point in the history
  • Loading branch information
tkdals802 committed Jun 26, 2024
1 parent b8b2e4c commit 2505237
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.springframework.web.bind.annotation.RestController;

import com.m3pro.groundflip.domain.dto.Response;
import com.m3pro.groundflip.domain.dto.community.CommunitySearchListResponse;
import com.m3pro.groundflip.domain.dto.community.CommunityInfoResponse;
import com.m3pro.groundflip.domain.dto.community.CommunitySearchResponse;
import com.m3pro.groundflip.service.CommunityService;

import io.swagger.v3.oas.annotations.Operation;
Expand All @@ -24,9 +24,9 @@ public class CommunityController {
@Operation(summary = "그룹 검색", description = "그룹 이름 검색 키워드로 그룹들을 검색")
@Parameter(name = "searchKeyword", description = "그룹 검색 키워드", example = "홍익대")
@GetMapping("/api/groups")
public Response<List<CommunitySearchListResponse>> getAllCommunityByName(@RequestParam String searchKeyword) {
public Response<List<CommunitySearchResponse>> getAllCommunityByName(@RequestParam String searchKeyword) {
return Response.createSuccess(
communityService.findCommunityByName(searchKeyword)
communityService.findAllCommunityByName(searchKeyword)
);
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
@NoArgsConstructor
@Data
@Builder
public class ListResponseCommunity {
public class CommunitySearchResponse {
private String name;

public static ListResponseCommunity from(Community community) {
return ListResponseCommunity.builder()
public static CommunitySearchResponse from(Community community) {
return CommunitySearchResponse.builder()
.name(community.getName())
.build();
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import org.springframework.stereotype.Service;

import com.m3pro.groundflip.domain.dto.community.CommunitySearchListResponse;
import com.m3pro.groundflip.domain.dto.community.CommunitySearchResponse;
import com.m3pro.groundflip.domain.dto.community.CommunityInfoResponse;
import com.m3pro.groundflip.domain.entity.Community;
import com.m3pro.groundflip.repository.CommunityRepository;
Expand All @@ -17,9 +17,9 @@ public class CommunityService {

private final CommunityRepository communityRepository;

public List<CommunitySearchListResponse> findCommunityByName(String name) {
public List<CommunitySearchResponse> findAllCommunityByName(String name) {
List<Community> community = communityRepository.findAllByNameLike("%" + name + "%");
return community.stream().map(CommunitySearchListResponse::from).toList();
return community.stream().map(CommunitySearchResponse::from).toList();
}

public CommunityInfoResponse findCommunityById(Long id) {
Expand Down

0 comments on commit 2505237

Please sign in to comment.