diff --git a/user-service/src/main/java/kr/mafoo/user/api/MemberApi.java b/user-service/src/main/java/kr/mafoo/user/api/MemberApi.java index 2c0538a..0ee3b6a 100644 --- a/user-service/src/main/java/kr/mafoo/user/api/MemberApi.java +++ b/user-service/src/main/java/kr/mafoo/user/api/MemberApi.java @@ -4,7 +4,9 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import kr.mafoo.user.annotation.RequestMemberId; +import kr.mafoo.user.controller.dto.response.MemberDetailResponse; import kr.mafoo.user.controller.dto.response.MemberResponse; +import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -17,16 +19,23 @@ @Validated @RequestMapping("/v1/members") public interface MemberApi { - @Operation(summary = "사용자 검색", description = "키워드로 사용자를 검색합니다. (이름으로 검색)") + @Operation(summary = "공유 앨범 대상 사용자 검색", description = "키워드로 사용자를 검색합니다. (이름으로 검색)") @GetMapping - Flux getMemberListByName( + Flux getMemberListByNameForSharedAlbum( @RequestMemberId @Parameter(hidden = true) String requesterId, @Parameter(description = "검색어", example = "사람") @RequestParam - String keyword + String keyword, + + @Parameter(description = "앨범 ID", example = "test_album_id") + @RequestParam + String albumId, + + // Authorization Header를 받아올 목적 + ServerHttpRequest serverHttpRequest ); @Operation(summary = "사용자 단건 조회", description = "사용자 단건 정보를 조회합니다.") diff --git a/user-service/src/main/java/kr/mafoo/user/controller/MemberController.java b/user-service/src/main/java/kr/mafoo/user/controller/MemberController.java index 975c8fd..6395730 100644 --- a/user-service/src/main/java/kr/mafoo/user/controller/MemberController.java +++ b/user-service/src/main/java/kr/mafoo/user/controller/MemberController.java @@ -1,9 +1,11 @@ package kr.mafoo.user.controller; import kr.mafoo.user.api.MemberApi; +import kr.mafoo.user.controller.dto.response.MemberDetailResponse; import kr.mafoo.user.controller.dto.response.MemberResponse; import kr.mafoo.user.service.MemberService; import lombok.RequiredArgsConstructor; +import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -14,12 +16,16 @@ public class MemberController implements MemberApi { private final MemberService memberService; @Override - public Flux getMemberListByName( + public Flux getMemberListByNameForSharedAlbum( String requesterId, - String keyword + String keyword, + String albumId, + ServerHttpRequest serverHttpRequest ) { - return memberService.getMemberByKeyword(keyword) - .map(MemberResponse::fromEntity); + String authorizationToken = serverHttpRequest.getHeaders().getFirst("Authorization"); + + return memberService.getMemberByKeywordForSharedAlbum(keyword, albumId, authorizationToken) + .map(MemberDetailResponse::fromDto); } @Override