Skip to content

Commit

Permalink
[BE] fix: 기존 회원은 홈으로, 신규 회원은 마이페이지로 이동 (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
70825 authored Aug 3, 2023
1 parent dd6019a commit 256db71
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions backend/src/main/java/com/funeat/auth/dto/SignUserDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@

public class SignUserDto {

private final boolean isSignIn;
private final boolean isSignUp;
private final Member member;

public SignUserDto(final boolean isSignIn, final Member member) {
this.isSignIn = isSignIn;
public SignUserDto(final boolean isSignUp, final Member member) {
this.isSignUp = isSignUp;
this.member = member;
}

public static SignUserDto of(final boolean isSignIn, final Member member) {
return new SignUserDto(isSignIn, member);
public static SignUserDto of(final boolean isSignUp, final Member member) {
return new SignUserDto(isSignUp, member);
}

public boolean isSignIn() {
return isSignIn;
public boolean isSignUp() {
return isSignUp;
}

public Member getMember() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public ResponseEntity<Void> loginAuthorizeUser(@RequestParam("code") final Strin
final Long memberId = signUserDto.getMember().getId();
request.getSession().setAttribute("member", memberId);

if (signUserDto.isSignIn()) {
if (signUserDto.isSignUp()) {
return ResponseEntity.ok()
.location(URI.create("/"))
.location(URI.create("/profile"))
.build();
}
return ResponseEntity.ok()
.location(URI.create("/profile"))
.location(URI.create("/"))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class loginAuthorizeUser_테스트 {
// given
final var code = "test";
final var member = new Member("test", "www.test.com", "1");
final var signUserDto = SignUserDto.of(true, member);
final var signUserDto = SignUserDto.of(false, member);

// when
when(authService.loginWithKakao(code)).thenReturn(signUserDto);
Expand All @@ -50,7 +50,7 @@ class loginAuthorizeUser_테스트 {
// given
final var code = "test";
final var member = new Member("test", "www.test.com", "1");
final var signUserDto = SignUserDto.of(false, member);
final var signUserDto = SignUserDto.of(true, member);

// when
when(authService.loginWithKakao(code)).thenReturn(signUserDto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class findOrCreateMember_테스트 {

// then
assertSoftly(softAssertions -> {
Assertions.assertFalse(actual.isSignIn());
Assertions.assertFalse(actual.isSignUp());
assertThat(expected).containsExactly(actual.getMember());
});
}
Expand All @@ -69,7 +69,7 @@ class findOrCreateMember_테스트 {

// then
assertSoftly(softAssertions -> {
Assertions.assertTrue(actual.isSignIn());
Assertions.assertTrue(actual.isSignUp());
assertThat(expected).doesNotContain(actual.getMember());
});
}
Expand Down

0 comments on commit 256db71

Please sign in to comment.