Skip to content

Commit

Permalink
feat: 내 회원정보 조회 API 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
bflykky committed Aug 4, 2024
1 parent a1be299 commit b4a8f68
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import com.umc.naoman.domain.member.converter.MemberConverter;
import com.umc.naoman.domain.member.dto.MemberResponse;
import com.umc.naoman.domain.member.dto.MemberResponse.MemberInfo;
import com.umc.naoman.domain.member.entity.Member;
import com.umc.naoman.domain.member.service.MemberService;
import com.umc.naoman.global.error.ErrorResponse;
import com.umc.naoman.global.result.ResultResponse;
import com.umc.naoman.global.result.code.MemberResultCode;
import com.umc.naoman.global.security.annotation.LoginMember;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
Expand All @@ -18,6 +20,8 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.umc.naoman.global.result.code.MemberResultCode.CHECK_MEMBER_REGISTRATION;

@RestController
@RequestMapping("/members")
@Tag(name = "회원 API", description = "회원 도메인의 API입니다.")
Expand All @@ -36,12 +40,18 @@ public class MemberController {
(responseCode = "EM001", description = "해당 memberId를 가진 회원이 존재하지 않습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
})
public ResultResponse<MemberResponse.MemberInfo> getMemberInfo(@PathVariable(name = "memberId") Long memberId) {
public ResultResponse<MemberInfo> getMemberInfo(@PathVariable(name = "memberId") Long memberId) {
Member member = memberService.findMember(memberId);
return ResultResponse.of(MemberResultCode.MEMBER_INFO,
memberConverter.toMemberInfo(member));
}

@GetMapping("/my")
@Operation(summary = "내 회원정보 조회 API", description = "자신의 회원 정보를 조회하는 API입니다.")
public ResultResponse<MemberInfo> checkSignup(@LoginMember Member member) {
return ResultResponse.of(CHECK_MEMBER_REGISTRATION, memberService.getMyInfo(member));
}

@GetMapping("/terms/{memberId}")
@Operation(summary = "마케팅 약관 동의 여부 조회 API", description = "[PathVariable]\n memberId\n[request]\n" +
"[response]\n 마케팅 동의 여부 -> 동의 => true, 비동의 => false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.umc.naoman.domain.member.dto.MemberRequest.SignupRequest;
import com.umc.naoman.domain.member.dto.MemberResponse.CheckMemberRegistration;
import com.umc.naoman.domain.member.dto.MemberResponse.LoginInfo;
import com.umc.naoman.domain.member.dto.MemberResponse.MemberInfo;
import com.umc.naoman.domain.member.entity.Member;
import com.umc.naoman.domain.member.entity.SocialType;

Expand All @@ -16,5 +17,5 @@ public interface MemberService {
LoginInfo signup(SignupRequest request);
LoginInfo signup(String tempMemberInfo, MarketingAgreedRequest request);
LoginInfo login(LoginRequest request);
// MyPageInfo getMyPageInfo(Member member);
MemberInfo getMyInfo(Member member);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.umc.naoman.domain.member.dto.MemberRequest.SignupRequest;
import com.umc.naoman.domain.member.dto.MemberResponse.CheckMemberRegistration;
import com.umc.naoman.domain.member.dto.MemberResponse.LoginInfo;
import com.umc.naoman.domain.member.dto.MemberResponse.MemberInfo;
import com.umc.naoman.domain.member.entity.Member;
import com.umc.naoman.domain.member.entity.SocialType;
import com.umc.naoman.domain.member.repository.MemberRepository;
Expand Down Expand Up @@ -100,4 +101,9 @@ public LoginInfo login(LoginRequest request) {

return memberConverter.toLoginInfo(memberId, accessToken, refreshToken);
}

@Override
public MemberInfo getMyInfo(Member member) {
return memberConverter.toMemberInfo(member);
}
}

0 comments on commit b4a8f68

Please sign in to comment.