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

[WIP] 회원가입/로그인 리펙토링 #12

Merged
merged 21 commits into from
Jan 9, 2025
Merged

Conversation

gru3530
Copy link
Collaborator

@gru3530 gru3530 commented Dec 29, 2024

[주요변경점]

  • UserService에서 수행하던 dto valid 책임을 dto 클래스로 변경
  • Repository 관리 책임을 CommonService로 변경
  • ApiResponse -> ApiResponseEnum 네이밍 변경
  • ApiResponseDto -> ApiResult로 변경
    • UserService에서 리턴하는 Result를 공통으로 처리하기 위해 success, error 메서드를 사용하도록 구성
  • ApiResponseEnum에서 불필요 항목 삭제
    • CustomException을 추가하고, 클라이언트로 명확한 에러 상황을 전달하기 위해 Enum값 전달
    • 요청 실패 시 하기와 같이 전달
{
      "code": "EMPTY_PASSWORD",
      "message": "비밀번호가 비어있습니디"
}
  • CustomException 추가
    • UserGlobalExceptionHandler에서 User패키지에서 발생하는 에러를 ApiResponseEnum을 통해 통합핸들링
    • CustomException들은 BaseApiException을 상속받아 에러 내용 생성하여 클라이언트를 전달

gru added 21 commits December 24, 2024 10:39
회원가입시에만 사용가능한 enum을 공통으로 사용할 수 있도록 ApiResponse로 변경
클라이언트로 받은 요청을 객체로 리턴하도록 Dto 추가
/users 공통되어 @RequestMapping으로 통합
commonService에서 처리
명시적으로 표현하기위해 네이밍 변경
ApiRepsonse -> ApiResponseEnum
ApiResponseDto를 공통 결과 클래스 ApiResult로 변경
실패할 경우
{
    "code": "EMPTY_EMAIL",
    "message": "이메일이 비어있습니다",
    "data": null
}

성공할 경우

{
    "code": "SUCCESS",
    "message": "요청에 성공하였습니다",
}
JsonInclude 추가.
NON_NULL로 설정한 경우 빈 값도 들어갈 수 있기떄문에 NON_EMPTY로 설정
commonService -> CommonService
@gru3530 gru3530 merged commit 08bde3f into main Jan 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant