-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor/#82 : Auth Domain 리팩토링 #83
Conversation
public void create(BsmResourceResponse resource) { | ||
userRepository.save( | ||
User.builder() | ||
.email(resource.getEmail()) | ||
.nickName(resource.getNickname()) | ||
.authority(Authority.USER) | ||
.enroll(resource.getStudent().getEnrolledAt()) | ||
.name(resource.getStudent().getName()) | ||
.build() | ||
); | ||
} |
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.
dto를 넘겨서 저장하기 보단 비즈니스 레이어에서 엔티티로 변환 후 User를 매개변수로 받아서 저장하는 건 어떨까요? 이러한 방법이 재사용성을 더 높일 수 있을 것 같아요
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.
저는 handler에서 가져올 때 바로 User로 가져오면 좋겠다는 생각이 들어요. 그렇게 하면, 다른 implementation레이어나 service레이어는 BSM의 상세 구현에 대한 의존 없이 작동할 수 있기 때문에 유지보수성이 좋아질 거라고 생각해요.
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.
public void create(User user) {
userRepository.save(user);
}
제가 말한 방식은 이러한 방식이었습니다
비즈니스 레이어에서 dto.toEntity()
와 같은 방법으로 dto를 entity로 변환 후 create(dto.toEntity())
이런식으로 메서드를 호출한다면 재사용성이 늘어날 것 같습니다!
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.
toEntity 쓰고싶지만 라이브러리라 사용 할 수 없어요ㅜㅜ
src/main/java/com/project/bumawiki/domain/user/implementation/UserUpdater.java
Outdated
Show resolved
Hide resolved
src/main/java/com/project/bumawiki/domain/auth/infra/BsmLoginHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/com/project/bumawiki/domain/auth/infra/BsmLoginHandler.java
Outdated
Show resolved
Hide resolved
|
수정한 내용과 이유
Login과 Refresh 로 분리된 서비스를 Command로 분리함.
비즈니스 흐름이 잘보이도록 Implementation Layer로 분리함
Controller 에서 RequestHeader로 받고 있던 정보들을 Request Body에서 받도록 했습니다
close #82