diff --git a/src/main/java/com/climingo/climingoApi/auth/api/AuthController.java b/src/main/java/com/climingo/climingoApi/auth/api/AuthController.java index 4febd0c..7e77a3e 100644 --- a/src/main/java/com/climingo/climingoApi/auth/api/AuthController.java +++ b/src/main/java/com/climingo/climingoApi/auth/api/AuthController.java @@ -52,14 +52,7 @@ public ResponseEntity signIn( MemberInfo memberInfo = authService.findMemberInfo(userInfo); - return ResponseEntity.ok().body( - SignInUpResponse.builder() - .nickname(memberInfo.getNickname()) - .authId(memberInfo.getAuthId()) - .providerType(memberInfo.getProviderType()) - .profileUrl(memberInfo.getProfileUrl()) - .email(memberInfo.getEmail()) - .build()); + return ResponseEntity.ok().body(SignInUpResponse.from(memberInfo)); } @PostMapping("/sign-up") @@ -78,14 +71,7 @@ public ResponseEntity signUp( CookieUtils.addCookie(request, response, "refreshToken", tokenResponse.getRefreshToken(), JwtUtil.REFRESH_TOKEN_EXP); - return ResponseEntity.ok().body( - SignInUpResponse.builder() - .nickname(memberInfo.getNickname()) - .authId(memberInfo.getAuthId()) - .providerType(memberInfo.getProviderType()) - .profileUrl(memberInfo.getProfileUrl()) - .email(memberInfo.getEmail()) - .build()); + return ResponseEntity.ok().body(SignInUpResponse.from(memberInfo)); } @GetMapping("/auth/members/exist") diff --git a/src/main/java/com/climingo/climingoApi/auth/api/response/MemberInfo.java b/src/main/java/com/climingo/climingoApi/auth/api/response/MemberInfo.java index 7e75638..1fb7877 100644 --- a/src/main/java/com/climingo/climingoApi/auth/api/response/MemberInfo.java +++ b/src/main/java/com/climingo/climingoApi/auth/api/response/MemberInfo.java @@ -7,6 +7,7 @@ public class MemberInfo { private final String nickname; + private final Long memberId; private final String authId; private final String providerType; private final String email; @@ -14,6 +15,7 @@ public class MemberInfo { public MemberInfo(Member member) { this.nickname = member.getNickname(); + this.memberId = member.getId(); this.authId = member.getAuthId(); this.providerType = member.getProviderType(); this.email = member.getEmail(); diff --git a/src/main/java/com/climingo/climingoApi/auth/api/response/SignInUpResponse.java b/src/main/java/com/climingo/climingoApi/auth/api/response/SignInUpResponse.java index 8b09f23..d16cd54 100644 --- a/src/main/java/com/climingo/climingoApi/auth/api/response/SignInUpResponse.java +++ b/src/main/java/com/climingo/climingoApi/auth/api/response/SignInUpResponse.java @@ -7,18 +7,31 @@ public class SignInUpResponse { private final String nickname; + private final Long memberId; private final String authId; private final String providerType; private final String email; private final String profileUrl; @Builder - public SignInUpResponse(String nickname, String authId, String providerType, String email, - String profileUrl) { + public SignInUpResponse(String nickname, Long memberId, String authId, String providerType, String email, + String profileUrl) { this.nickname = nickname; + this.memberId = memberId; this.authId = authId; this.providerType = providerType; this.email = email; this.profileUrl = profileUrl; } + + public static SignInUpResponse from(MemberInfo memberInfo) { + return SignInUpResponse.builder() + .nickname(memberInfo.getNickname()) + .memberId(memberInfo.getMemberId()) + .authId(memberInfo.getAuthId()) + .providerType(memberInfo.getProviderType()) + .profileUrl(memberInfo.getProfileUrl()) + .email(memberInfo.getEmail()) + .build(); + } }