-
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
[H조] 백엔드파트 코드리뷰용 PR #75
base: review
Are you sure you want to change the base?
Conversation
…d-base-class Chore#1: 라이브러리 추가 및 기본 응답/에러 클래스 생성
Fix#70: 완료된 할 일 desc -> asc
Refactor: 1차 기능 리팩토링 및 테스트코드 추가
Fix: Test용 redis 도입
Fix: test용 redis 포트번호 수정
Fix: backlog 리스트 조회 수정
Refactor: scheduler
…blocks Feat#79: 튜토리얼 데이터 추가
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.
질문주신 내용은 코드리뷰로 작성해두었습니다.
간접참조와 직접참조를 구분하는것이 쉽지 않았을것 같은데, 수고하셨습니다 👍
@@ -0,0 +1,31 @@ | |||
--- | |||
name: "\U0001F954Poptato Server Issue Template" |
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.
🥔
System.out.println("Default Time Zone: " + java.util.TimeZone.getDefault().getID()); | ||
System.out.println("Hello Poptato Server Team !!"); |
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.
System print 보다는 logger를 사용하는것은 어떨까요?
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ReissueTokenRequestDto { | ||
//TODO: 사용안하는 필드 |
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.
@Deprecated
로 명시하면 사용하는 측에서도 더이상 사용하지 않는필드라고 인지할 수 있습니다.
Optional<User> user = userRepository.findByKakaoId(userInfo.socialId()); | ||
if (user.isEmpty()) { | ||
LoginResponseDto response = createNewUserResponse(userInfo); | ||
createTutorialData(response.userId()); | ||
return response; | ||
} |
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.
Optional을 쓰면서 if문이 필요한 경우는 드뭅니다. (가독성을 위해 일부러 사용하는 경우를 제외하고는)
지금 상황에서도 if문을 없앨 수 있을거 같아요.
@@ -0,0 +1,127 @@ | |||
package server.poptato.auth.application.service; |
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 -> private으로 메소드를 정렬했다고 해주셨는데요, 이 클래스가 그렇게 되어있는 것 같아요.
읽기 좋은 코드는 어떻게 정렬되어 있어야 할까요? public -> private 순 이라기 보다는 사용하는 함수의 바로 아래에 위치한게 읽기 편한것 같습니다. (책 처럼 읽히는)
현재는 어떤 private 메소드를 사용하는지 추적하기위해 스크롤을 너무 많이 내려야 하는것 같아요.
관련해서 클린코드에도 이런 내용이 나오는데 읽어보셔도 좋을거 같습니다.
import server.poptato.external.oauth.SocialPlatform; | ||
import server.poptato.external.oauth.SocialService; | ||
import server.poptato.external.oauth.SocialServiceProvider; | ||
import server.poptato.external.oauth.SocialUserInfo; |
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.
external레이어와 service레이어 중 도메인 로직이 있는 service 레이어가 더 중요한 레이어 같은데요.
이렇게, service -> external로 의존성이 가게 되면, external이 변경되었을때 service도 함께 변경되어야 하지 않을까요?
인터페이스 위치를 조정해서 external -> service에 의존하도록 만드는것은 어떨까요?
|
||
|
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 updateDeadline(Long userId, Long todoId, DeadlineUpdateRequestDto deadlineUpdateRequestDto) { | ||
userValidator.checkIsExistUser(userId); | ||
Todo findTodo = validateAndReturnTodo(userId, todoId); | ||
findTodo.updateDeadline(deadlineUpdateRequestDto.getDeadline()); | ||
//TODO: 여기도 왜 SAVE가 필수인지 몰겟담 | ||
todoRepository.save(findTodo); | ||
} |
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.
어떻게 테스트 하셨나요??
저도 로직을 보니 변경감지가 적용되지 않을 이유가 없어보이는데요.
예상치못한 동작을 하는경우는 대표적으로
- 외래키로 걸려있는경우 연관관계 주인을 업데이트 해주지 않았을때 <- 지금은 해당되지 않음.
- 트랜잭션 중간에 다른 주솟값을 가진 Entity로 복사되었을때 영속성 컨텍스트에서 detach 되기 때문에 변경감지가 동작하지 않음 <- 마찬가지로 해당 X
- DataJpaTest를 수행했을때 테스트 함수에 Transactional이 붙기 때문에 적용되지 않은것 처럼 느낄 수 있음.
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
@NotNull | ||
private Long userId; |
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.
여기가 질문주신 간접참조를 한 곳 이군요 ㅎㅎ
구현하신것 처럼 다른 도메인의 경우 직접참조 대신 간접참조를 사용하곤 합니다. 👍
이유는, 소스코드가 커졌을때, 직접 참조를 하게 될 경우 Todo에서 User의 정보를 변경할수도 있고, DB join 관리와 코드가 복잡해지기 때문이에요.
fk 같은경우 상황에 따라 다른데, 저는 걸지 않고 애플리케이션 로직으로 정합성을 맞추는것을 선호합니다. fk를 걸게되면 운영할때 fk로 인해서 힘들어지는 경우가 많아서요 ㅎㅎ
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
public interface JpaTodoRepository extends TodoRepository, JpaRepository<Todo,Long> { |
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.
TodoRepository와 JpaRepository를 분리해서 어떤 이점이 있을까요?
JPA가 바뀔일이 흔할까요? 오히려 불필요한 코드가 늘어나는것 아닐까요?
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.
질문주신 내용은 코드리뷰로 작성해두었습니다.
간접참조와 직접참조를 구분하는것이 쉽지 않았을것 같은데, 수고하셨습니다 👍
Resolves #{이슈-번호}
Issue Define
Summary of resolutions or improvements
Note