-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/#168 로그인api 반환 값 변경 #169
The head ref may contain hidden characters: "Feature/#168-\uB85C\uADF8\uC778API_\uBC18\uD658_\uAC12_\uBCC0\uACBD"
Conversation
if (memberDetail instanceof StudentMember studentMember) { | ||
String role = Role.ROLE_MEMBER.toString(); | ||
|
||
String accessToken = jwtTokenProvider.createToken(member.getId(), role); | ||
String accessToken = jwtTokenProvider.createToken(member.getId(), role); | ||
|
||
return SignInResponse.of(member, role, isModerator, accessToken); | ||
return SignInResponse.of(member, studentMember.getId(), role, false, accessToken); | ||
|
||
} else if (memberDetail instanceof FacultyMember facultyMember) { | ||
String role = Role.ROLE_ADMIN.toString(); | ||
|
||
String accessToken = jwtTokenProvider.createToken(member.getId(), role); | ||
|
||
return SignInResponse.of(member, facultyMember.getId(), role, true, accessToken); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분에서 if문을 사용하지 않고 할 수 있는 방법이 있을까요?
코드가 약간 더러운 느낌이라서요...
아는 방법있으면 알려주세용!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고민을 해봤는데 지금 구조상 지금 방법이 최선인 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
금방 수정할 수 있는 부분이라 approve했습니다!
확인 부탁드려요~
if (memberDetail instanceof StudentMember studentMember) { | ||
String role = Role.ROLE_MEMBER.toString(); | ||
|
||
String accessToken = jwtTokenProvider.createToken(member.getId(), role); | ||
String accessToken = jwtTokenProvider.createToken(member.getId(), role); | ||
|
||
return SignInResponse.of(member, role, isModerator, accessToken); | ||
return SignInResponse.of(member, studentMember.getId(), role, false, accessToken); | ||
|
||
} else if (memberDetail instanceof FacultyMember facultyMember) { | ||
String role = Role.ROLE_ADMIN.toString(); | ||
|
||
String accessToken = jwtTokenProvider.createToken(member.getId(), role); | ||
|
||
return SignInResponse.of(member, facultyMember.getId(), role, true, accessToken); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고민을 해봤는데 지금 구조상 지금 방법이 최선인 것 같습니다!
@@ -11,7 +11,7 @@ public record SignInResponse( | |||
String token | |||
) { | |||
|
|||
public static SignInResponse of(Member member, String role, Boolean isModerator, String token) { | |||
return new SignInResponse(member.getId(), member.getName(), member.getEmail(), role, isModerator, token); | |||
public static SignInResponse of(Member member, long member_id, String role, Boolean isModerator, String token) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사소한거긴 한데 객체로 다룰 수 있는 Long 타입을 사용해주시면 좋을 것 같습니다!
그리고 변수명은 카멜케이스로 부탁드립니다! (memberId)
email varchar(255) not null, | ||
name varchar(255) not null, | ||
password varchar(255) not null, | ||
phone_number varchar(255) not null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_authorized 값은 필요하지 않은 값인가요??👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넹.
이전에는 메일인증을 회원가입 다하고 난 뒤에 진행하는 방식이라서 메일 인증이 완료되었는지 필요했습니다.
하지만 지금은 회원가입 단계에서 메일인증을 받으므로 필요가 없어졌습니다.
혹시 다른 일 관련으로 사용처가 있었을까요?
관련 이슈
작업 요약
[BACKEND]
리뷰 요구 사항
3분