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

Fix: 즐찾 해제 시 자식 음식객체 연쇄삭제 명시적으로 추가 (#114) #119

Merged
merged 2 commits into from
Nov 22, 2023

Conversation

win-luck
Copy link
Contributor

  • FavoriteFood가 연관관계의 주인이나, FavoriteFood 소멸 시 이를 바라보던 자식 Food 객체가 null을 바라도록 처리되어야 함
  • 허나 의도대로 처리되지 않아 직접 setter로 명시적으로 음식들의 즐찾여부를 해제

@win-luck win-luck added the fix 버그 및 오류 수정 label Nov 21, 2023
@win-luck win-luck requested a review from synoti21 November 21, 2023 14:47
@win-luck win-luck self-assigned this Nov 21, 2023
@@ -128,6 +128,8 @@ public void updateFavoriteFood(UpdateFavoriteFoodDto updateFavoriteFoodDto) {
@Transactional
public void deleteFavoriteFood(Long favoriteFoodId, Long userId) {
validateFavoriteFood(favoriteFoodId, userId);
FavoriteFood favoriteFood = getFavoriteFoodById(favoriteFoodId);
favoriteFood.getFoods().forEach(food -> food.setFavoriteFood(null)); // 즐겨찾기 음식으로부터 태어난 음식들의 즐겨찾기 정보를 null로 초기화
Copy link
Contributor

Choose a reason for hiding this comment

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

Cascade가 잘 이루어지지 않는 것 같은데, 일단 이렇게 하되, 나중에 좀 논의를 해봐야 할 것 같습니다.

@synoti21
Copy link
Contributor

빌드 테스트 실패했는데 확인 부탁드립니다!

@synoti21 synoti21 merged commit 258b335 into master Nov 22, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix 버그 및 오류 수정
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix: 즐겨찾기 버그 수정을 위한 음식-즐겨찾는음식 연관관계 개편 (#114)
2 participants