-
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
[LIME-61] bucket - bucketItem - item 양방향 연관관계 제거 #29
Conversation
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 modifyBucket( | ||
final BucketInfo bucketInfo, | ||
final Long memberId | ||
) { | ||
this.memberId = Objects.requireNonNull(memberId); | ||
public void modifyBucket(final BucketInfo bucketInfo) { | ||
this.bucketInfo = bucketInfo; | ||
} |
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.
p5;
bucket- bucketItem 연관 관계를 제거하는데 modifyBucket 메서드가 수정 된 이유를 모르겠습니다. 설명 부탁드립니당!
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.
연관관계와 관련 없이 memberId가 수정될 가능성이 없어서 제거했습니다.
지난 코드에서 불필요한 인자였더라구요
BucketItem bucketItem = new BucketItem(itemId, bucketId); | ||
|
||
return bucketItem; |
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.
p5;
return new BucketItem(itemId, bucketId);
이렇게 작성하는 것은 어떤가요??
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.
d827982 반영 완!
given(bucketItemRepository.findAllByBucketId(anyLong())) | ||
.willReturn(BucketBuilder.buildBucketItems(bucketId,new ItemIdRegistry(Arrays.asList(1L,2L,3L,4L)))); |
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.
p2;
willReturn 부분은 변수로 따로 빼면 가독성이 더 좋아질 것 같아요!
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.
d827982 반영 완!
.join(item).on(bucketItem.item.id.eq(item.id)) | ||
.where(bucketItem.bucket.id.in(bucketIds)) | ||
.join(item).on(bucketItem.itemId.eq(item.id)) | ||
.join(bucket).on(bucketItem.bucketId.eq(bucket.id)) | ||
.where(bucketItem.itemId.in(bucketIds)) |
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.
p5;
새로 추가된 where 부분이 이해가 잘 가지 않아요! bucketItem의 itemId가 bucketIds 안에 존재하면 되는 건가요..? 혹시 변수명을 잘못 적은 건가요??
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.
리팩토링 과정에서 변수를 잘못 적었던 것 같아요 결과가 정상적으로 나와서 캐치하지 못했네요 고마워요!
80e4f57 반영 완!
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.
고생하셨습니다👍 저도 연관관계 제거할 때 많이 참고하겠습니다!
📌 PR 종류
어떤 종류의 PR인지 아래 항목 중에 체크 해주세요.
📌 어떤 기능이 추가 되었나요?
bucket - bucketItem - item간 연관관계를 제거함
Issue Number
lime - 61
기능 설명
연관관계가 불필요한 상황이라고 생각해 양방향 연관관계를 제거했습니다.
이유1 : 객체의 생명주기가 item과 bucket이 일치하지 않는다.
이유2 : 강결합
여러 관점에서 살펴보았을 때 불편함을 가져가더라도 기술적인 분리를 하면서 유의미한 코드를 작성하는게 좋다고 생각합니다.
트러블 슈팅
org.hibernate.query.semanticexception: could not interpret path expression in querydsl transform
사이드이펙트
아직 수정하지는 않겠습니다.
📌 기존에 있던 기능에 영향을 주나요?