-
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
Feat#3: 카카오로그인 구현 #4
Conversation
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.
requestDTO는 Controller가 관리하니까, api>request>requestDTO.java, application>response>responseDTO.java로 관리하는 게 어떨까요?
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.
고생하셨습니다!
@Getter | ||
@SuperBuilder | ||
@Inheritance(strategy = InheritanceType.JOINED) | ||
@NoArgsConstructor |
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.
NoArgsConstructor는 JPA가 DB에 저장할 때 외에는 막아두는 건 어떨까요? 'accessLevel=Protected' 로요!
@Entity | ||
@Getter | ||
@SuperBuilder | ||
@Inheritance(strategy = InheritanceType.JOINED) |
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.
해당 어노테이션의 사용 이유는 뭔가요? User 도메인이 상속관계로 이루어져 있나요?
|
||
@Entity | ||
@Getter | ||
@SuperBuilder |
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.
@builder 대신 @SuperBuilder를 사용한 이유는 뭔가요?
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.
필드는 DB 설계서를 보고 수정 부탁드립니다!
@PostMapping("/login") | ||
public BaseResponse<LoginResponseDto> login( | ||
@KakaoCode String kakaoCode, | ||
HttpServletRequest request) { |
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.
이것도 @kakaocode 처럼 Resolver를 활용해서 request에서 Origin만 뽑아내는 건 어떨까요? 그리고 origin의 쓰임이 궁금합니다!
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.
음 목적은 cors 에러라고 하는데 사실 kakao 에서 유저정보를 빼올떄 redirect uri 만드는 용도로 매개변수 느낌으로 쓰는 거 같습니다! header 에서 값만 받는게 resolver 쓰는거보다 간단할 거 같은데 어떤가요?
String kakaoId = info.kakaoId(); | ||
String name = info.nickname(); | ||
Optional<User> user = userRepository.findByKakaoId(kakaoId); | ||
if (user.isEmpty()) { |
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.
createNewUserResponse() 로 리팩토링 하는 게 좋아보여요!
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.
UserCreateResponse가 Global에 있는 이유가 뭔가요? Auth 도메인에 있는 게 맞지 않을까요?
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.
Token,Redis 관련은 global과 같은 계층의 infrastructure에 따로 넣어두는 건 어떨까요?
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.
JpaRepository는 infrastructure 계층에 가야할 것 같아요! 도메인에 repository를 두고자 한다면, 도메인에는 인터페이스 repository만 두고, JpaRepository가 해당 인터페이스를 상속받는걸로 진행하면 되지 않을까 싶습니다!
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.
이런 Response 클래스들도 Builder 패턴을 사용하는 건 어떨까요? Builder 패턴은 인자를 넘길 때 직관적으로 어떤 필드인지 알 수 있다는 장점이 있습니다!
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.
LGTM!
Resolves #3
Issue Define
Summary of resolutions or improvements
회원가입 시 "회원가입에 성공했습니다" , isNewUser = True
header 에는 Bearer + (한칸 공백) + 인가코드
origin 넣어야 됨
redis 에 userId 1 키 에 값으로 refresh token 저장
Note