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

[#25] 회원 가입, 로그인 API개발 #27

Merged
merged 13 commits into from
Mar 28, 2024
Merged

[#25] 회원 가입, 로그인 API개발 #27

merged 13 commits into from
Mar 28, 2024

Conversation

GaHee99
Copy link
Contributor

@GaHee99 GaHee99 commented Mar 28, 2024

👨‍💻 작업 사항

📑 PR 개요

  • 로그인, 회원가입 로직 개발
  • @Login 어노테이션 개발

✅ 작업 목록

  • feign client도입
  • 회원가입, 로그인 API개발
  • 어노테이션 개발
  • Exception 클래스 세부설정

🙏 리뷰어에게

  • Feign client를 도입하여 kakao API와 통신했습니다.

  • 유효하지 않은 kakao token 일 경우, AuException을 터뜨리도록 로직을 구성했습니다.

  • User엔티티에서 OAuthProvider를 enum타입으로 선언했습니다.

  • jwt 토큰을 도입하여 loing 로직을 구현했습니다.

  • 현재 Exception이 발생했을 때, 코드만 보여주고 있는데 이부분 확인해주시면 감사하겠습니다.

  • kakao API부분을 현재 external 패키지에 선언했는데, 폴더링 관련해서는 금요일 이후에 다시 얘기 나눠보면 좋을 것 같아요


기타

  • 유저 랜덤 nickname은 아직 구현이 안된 상태입니다. 이 부분은 금요일 오후에 진행해보겠습니다.
  • 랜덤 숫자를 어떻게 구현하면 좋을지 찾고 있습니당
    Closes 회원 가입, 로그인 API개발  #25

Prefix

PR 코멘트를 작성할 때 항상 Prefix를 붙여주세요.

  • P1: 꼭 반영해주세요 (Request changes)
  • P2: 적극적으로 고려해주세요 (Request changes)
  • P3: 웬만하면 반영해 주세요 (Comment)
  • P4: 반영해도 좋고 넘어가도 좋습니다 (Approve)
  • P5: 그냥 사소한 의견입니다 (Approve)

@GaHee99 GaHee99 added the 신규 기능 [feat] 새로운 기능을 추가한다. label Mar 28, 2024
@GaHee99 GaHee99 requested a review from jay-so March 28, 2024 06:49
@GaHee99 GaHee99 self-assigned this Mar 28, 2024
Copy link
Member

@jay-so jay-so left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GaHee99
가희님 코드 작성하느라 수고하셨습니다!
개행과 git actions 상에 에러 부분 확인 다시 한번 확인해주세요!


@FeignClient(name = "kakaoApiClient", url = "https://kapi.kakao.com")
public interface KakaoApiClient {
@GetMapping(value = "/v2/user/me")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
클래스나, 인터페이스 명 뒤에는 한줄 띄워주세요~

@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class KakaoUserResponse {
private Long id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3
여기도요~

@Getter
@Configuration
public class AuthConfig {
@Value("${jwt.secret}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
여기도 개행 해주세요~

@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class UserLoginRequest {
private String token;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
여기도 개행 해주세요~

import com.eodya.api.common.exception.ExceptionCode;

public class AuthException extends BusinessException {
public AuthException(ExceptionCode exceptionCode, Object... rejectedValues) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
여기도요~

@Getter
@RequiredArgsConstructor
public enum AuthExceptionCode implements ExceptionCode {
INVALID_KAKAO_TOKEN(HttpStatus.BAD_REQUEST, "AUT-001", "유효한 카카오 토큰이 아닙니다."),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
해당 부분도 개행 체크해주세요~

import com.eodya.api.common.exception.ExceptionCode;

public class UserException extends BusinessException {
public UserException(ExceptionCode exceptionCode, Object... rejectedValues) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
해당 부분도 개행해주세요~

@Getter
@RequiredArgsConstructor
public enum UserExceptionCode implements ExceptionCode {
USER_NOT_FOUND(HttpStatus.NOT_FOUND, "USE-001", "해당하는 유저를 찾을 수 없음"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3: 개행 해주세요~

import org.springframework.data.jpa.repository.JpaRepository;

public interface UserRepository extends JpaRepository<User, Long> {
Optional<User> findByOAuthId(String oauthId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
해당 부분도 개행 해주세요~

package com.eodya.api.users.service;

public interface SocialService {
String getOAuthId(String token);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3: 개행 해주세요~

@GaHee99 GaHee99 changed the title 회원 가입, 로그인 API개발 #25 [#25] 회원 가입, 로그인 API개발 Mar 28, 2024
@GaHee99 GaHee99 merged commit 90e7fe2 into develop Mar 28, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
신규 기능 [feat] 새로운 기능을 추가한다.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

회원 가입, 로그인 API개발
2 participants