Skip to content

Commit

Permalink
feat: implement photo-service's MemberService
Browse files Browse the repository at this point in the history
  • Loading branch information
gmkim20713 committed Nov 21, 2024
1 parent a445724 commit 316c8cf
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import org.springframework.web.reactive.function.client.WebClient;

Expand All @@ -28,8 +29,24 @@ public Mono<MemberDto> getMemberInfoByToken(String authorizationToken) {
}

public Mono<MemberDto> getMemberInfoById(String memberId, String authorizationToken) {
// TODO : API 구현 후 연결 필요
return Mono.empty();
return client
.get()
.uri(endpoint + "/user/v1/members/" + memberId)
.header("Authorization", "Bearer " + authorizationToken)
.retrieve()
.onStatus(status -> !status.is2xxSuccessful(), (res) -> Mono.error(new MafooUserApiFailed()))
.bodyToMono(MemberDto.class);
}

public Flux<MemberDto> getMemberListByKeyword(String keyword, String authorizationToken) {
return client
.get()
.uri(endpoint + "/user/v1/members?keyword=" + keyword)
.header("Authorization", "Bearer " + authorizationToken)
.retrieve()
.onStatus(status -> !status.is2xxSuccessful(), (res) -> Mono.error(new MafooUserApiFailed()))
.bodyToFlux(MemberDto.class);
}

}

0 comments on commit 316c8cf

Please sign in to comment.