Skip to content

Commit

Permalink
add: signIn, signUp response body에 memberId 추가 (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bellroute authored Aug 6, 2024
1 parent 6b65af9 commit c749510
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
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();
}
}

0 comments on commit c749510

Please sign in to comment.