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

refactor: Choice에서 ChoiceContent를 지연 로딩한다 #188

Merged
merged 10 commits into from
Mar 8, 2024

Conversation

melonturtle
Copy link
Contributor

What is this PR? 🔍

  • 예전에 fix: choice 응답시 content 클래스 타입 조회할 수 있도록 즉시 로딩 #160 에서, 프록시로 인해 클래스 비교를 못하는 이유로 즉시 로딩으로 수정했었습니다.
  • 아마 choice 관련 가장 많이 사용될 유스케이스가 투표일 것 같은데, choice content를 알 필요가 없이 choice에 투표만 하면 되는데도 즉시 로딩이 되어서 지연 로딩이 나을 것 같아 revert하고 수정했습니다.
    • 물론 지금은 투표하면 응답으로 choice content까지 보내주고 있어 조회가 항상 일어나지만, 그래도 투표의 관점에선 choice content를 알 필요 없음
  • 이전 PR에서 언급한대로 프록시에 대해 instanceOf를 못하므로 각 ChoiceContent 엔티티 안에 response 모델로 바꾸는 코드를 추가했습니다.
    • 그 전에 이렇게 안한 이유가 엔티티에 dto 관련 정보가 섞여도 괜찮을지 모르겠어서였는데, ChoiceContent 정도면 모델에 변화가 거의 없을 것 같아 괜찮다고 판단했습니다.
    • response 타입들을 ChoiceContentResponse 인터페이스 안에 모아둘 수 있어서 더 관리하기 편할 수도?

@melonturtle melonturtle requested a review from 60jong March 4, 2024 10:43
기존에 있던 equals는 언제 사용되는지 모르겠지만, 클래스 내에서 구현할 경우에 다양한 상황에서 비교되는 상황을 생각해야함. Keyword가 영속화되기 전엔 id로 비교할 수가 없으므로 id를 제외한 다른 필드로 equals와 equals를 구현하므로 hashCode까지 같이 구현.
@melonturtle
Copy link
Contributor Author

다음 코드 위해 머지하겠습니다

@melonturtle melonturtle merged commit 41f72b0 into main Mar 8, 2024
1 check passed
@melonturtle melonturtle deleted the refactor branch March 8, 2024 16:39
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