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

[#104] HttpSessionUtils 클래스 생성, 패키지 변경, 아주 약간의 리팩토링 #114

Merged
merged 3 commits into from
Mar 27, 2020

Conversation

beginin15
Copy link
Contributor

@beginin15 beginin15 commented Mar 27, 2020

Closed #104
Closed #109

  • common 패키지를 생성하여 공통적으로 사용하는 내용들을 모아봤습니다.
  • domain 클래스에서 entity 별로 폴더를 구분했습니다.
  • exceptiona 패키지 명 변경했습니다
  • ErrorMessages 클래스를 이용하여 에러 메세지 상수를 모았습니다.
  • 브랜치명이 구려서 죄송합니닷ㅎㅎ
  • 리팩토링 넘나 어려운 것

  • 예외 처리 내용이 컨트롤러에서 많아져서 ExceptionController를 정의할까 고민입니다.

- common 패키지 : 공통적으로 필요한 패키지를 모아둠.
- common/exception 패키지 : 커스텀 예외 처리 클래스를 모아둠.
- common/response 패키지 : 응답 객체를 모아둠.
- domain 패키지 : entity 클래스와 repository를 모아둠.
- 로그인 세션과 관련된 기능을 모아둔 HttpSessionUtils 클래스 정의
- User 클래스에서만 사용하는 Gender enum을 중첩 enum 으로 선언
- ApiUserController에서 InvalidParameterException에 대한 에러 응답 객체를 반환하도록 변경
@beginin15 beginin15 added the enhancement New feature or request label Mar 27, 2020
@beginin15 beginin15 added this to the 회원가입 페이지 milestone Mar 27, 2020
@beginin15 beginin15 requested a review from ksundong March 27, 2020 06:10
@beginin15 beginin15 self-assigned this Mar 27, 2020
Copy link
Member

@ksundong ksundong left a comment

Choose a reason for hiding this comment

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

고생하셨습니다. 저도 리팩토링 하겠습니다.


public static final String FORBIDDEN = "접근 권한이 없습니다.";
public static final String UNAUTHORIZED = "로그인이 필요합니다.";
public static final String INVALID_PARAMETER = "Validation을 통과하지 못한 값 입니다.";
Copy link
Member

Choose a reason for hiding this comment

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

앗... 이거 그냥 Custom Exception으로 처리해주셔도 될 것 같아요..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ksundong Custom Exception 클래스에서 내부적으로 메세지를 가지고 있도록 말씀하시는걸까요?

Copy link
Member

Choose a reason for hiding this comment

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

아니요 INVAILD_PARAMETER Exception은 Custom Exception이 아니거든요...
제가 Refactor 하겠습니다.

private HttpSessionUtils() {}

public static Optional<User> getLoginedUserFromSession(HttpSession session) {
return Optional.ofNullable((User)session.getAttribute(SESSION_LOGINED_USER));
Copy link
Member

Choose a reason for hiding this comment

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

제가 원하던 겁니다. 👍

@ksundong ksundong merged commit 79dfbe9 into develop Mar 27, 2020
@ksundong ksundong deleted the feature/be/refactorPackage branch March 27, 2020 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants