Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#101] 로그인 api 응답 바디에 memberId 추가 #103

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,7 @@ public ResponseEntity<SignInUpResponse> 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")
Expand All @@ -78,14 +71,7 @@ public ResponseEntity<SignInUpResponse> 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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
public class MemberInfo {

private final String nickname;
private final Long memberId;
private final String authId;
private final String providerType;
private final String email;
private final String profileUrl;

public MemberInfo(Member member) {
this.nickname = member.getNickname();
this.memberId = member.getId();
this.authId = member.getAuthId();
this.providerType = member.getProviderType();
this.email = member.getEmail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Loading