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

[NAYB-81] feat: 사용자와 연관된 데이터를 제거 #106

Merged
merged 17 commits into from
Sep 15, 2023

Conversation

hseong3243
Copy link
Collaborator

@hseong3243 hseong3243 commented Sep 15, 2023

⛏ 작업 사항

  • 사용자 삭제시 사용자와 연관된 데이터를 삭제하도록 작업하였습니다.
  • Delivery의 경우 라이더에게 중요한 데이터이기에 제거하지 않고 남겨두었습니다. 더하여 조회시 빈번한 조인이 일어나는 Order의 일부 필드들을 반정규화 하였습니다.
  • 리뷰, 찜 상품, 장바구니, 장바구니 상품, 결제내역, 주문, 유저쿠폰, 유저가 삭제됩니다.
  • 상품, 카테고리, 이벤트, 쿠폰, 라이더는 삭제되지 않습니다.
  • 배달상품과의 연관관계를 끊고 주소 정보가 "삭제됨"이라는 텍스트로 대체됩니다.

📝 작업 요약

  • Delivery 반정규화(address, price, deliveryFee, riderRequest 추가)
  • 사용자와 연관된 엔티티 하드 딜리트

💡 관련 이슈

`Order`와의 연관관계만 끊어주도록 변경하였음
사용자 삭제 시 `Order`삭제 및 빈번한 조회의 사유로 `Delivery` 엔티티에 관련 필드들을 추가하여 반정규화하였음
@github-actions
Copy link

Test Results

345 tests  +3   345 ✔️ +3   8s ⏱️ ±0s
167 suites +2       0 💤 ±0 
167 files   +2       0 ±0 

Results for commit 45eca4c. ± Comparison against base commit 2c42625.


public interface CartItemRepository extends JpaRepository<CartItem, Long> {

List<CartItem> findAllByCartItemIdOrderByCreatedAt(Long cartItemId);

List<CartItem> findAllByCartOrderByCreatedAt(Cart cart);

@Modifying
Copy link
Member

Choose a reason for hiding this comment

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

이건 어떤 옵션인가요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Query를 사용할시 insert, update, delete 작업을 하기 위해 필요한 어노테이션입니다!

properties.setProperty("REDIS_HOST", "localhost");
properties.setProperty("REDIS_PORT", "6379");
properties.setProperty("spring.data.redis.host", "localhost");
properties.setProperty("spring.data.redis.port", "6379");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
properties.setProperty("spring.data.redis.port", "6379");
properties.setProperty("REDIS_HOST", "localhost");
properties.setProperty("REDIS_PORT", "6379");
properties.setProperty("spring.data.redis.host", "localhost");
properties.setProperty("spring.data.redis.port", "6379");

REDIS_HOST, spring.data.redis.host 둘 다 필요한가요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

해당 환경변수를 설정해주지 않으니 테스트가 안 돌아가서 추가해주었습니다!

@hseong3243 hseong3243 merged commit 5783271 into develop Sep 15, 2023
3 checks passed
@hseong3243 hseong3243 deleted the feature/NAYB-81 branch September 15, 2023 08:48
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.

None yet

2 participants