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] 컨텐츠 상세 조회와 최신 컨텐츠 포인트 차감 로직 분리 #452

Merged
merged 11 commits into from
Nov 27, 2024

Conversation

mooncw
Copy link
Collaborator

@mooncw mooncw commented Nov 27, 2024

PR 타입 (하나 이상의 PR 타입을 선택해주세요)

  • 기능 추가
  • 기능 삭제
  • 버그 수정
  • 문서 수정
  • 리팩토링
  • 스타일 수정
  • 테스트 코드 추가
  • 의존성, 환경 변수, 빌드 관련 코드 업데이트
  • 개발 환경 세팅

변경 사항

  • 최신 컨텐츠에 대한 포인트 차감을 API로 분리
  • Layered Architecture 컨벤션에 따라 해당 API를 구현
  • 최신 컨텐츠에 대한 포인트 차감 서비스 로직 동시성 테스트 구현
  • 동시성 문제를 확인함에 따라 Redis 분산 락 적용

참고 사항

셀프 체크리스트

  • 코드가 정상적으로 동작하는지 확인
  • 새로운 테스트를 추가했거나 기존 테스트를 통과하는지 확인
  • 코드 스타일 가이드에 맞게 포맷팅했는지 확인
  • 관련 문서를 업데이트했는지 확인

@mooncw mooncw added ✨ FEAT 기능 개발 🔖 HIGH Priority: HIGH ⚒️ REFACTOR 리팩토링 ✅ TEST 테스트 관련 🌚 BE 🏀 CW Moon Chanwook labels Nov 27, 2024
@mooncw mooncw requested a review from tigris24 November 27, 2024 07:31
@mooncw mooncw self-assigned this Nov 27, 2024
Copy link
Collaborator

@tigris24 tigris24 left a comment

Choose a reason for hiding this comment

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

메서드 명이나 스웨거 같은 부분에 대한 코멘트 확인해서 필요한 부분 수정 후에 머지하시면 될 것 같습니다
코멘트 전부 반영 안하셔도 괜찮을 것 같습니다

}

// contentId로 content 조회
@Override
Copy link
Collaborator

Choose a reason for hiding this comment

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

기존 private findContent 를 public findContent로 해서 find 와 findContent를 하나로 합쳐서 쓰는게 낫지 않을까요?
아니면 find의 메서드 명은 살짝이라도 바뀌어야 할 것 같아요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

private findContent를 만든 이유는 중복 코드를 제거하기 위해서 입니다.

저 같은 경우는 DataProvider에서 단순히 Content를 가져오는 경우에는 find만 작성하기는 합니다만....
User 서버 기준에서는 검증을 거치기 위한 Content를 가져오는 것이니, 그에 맞게 변경하면 좋을 것 같군요.

public boolean verifyContentView(ContentCommand.GetDetail command) {
contentReader.findContentIsActivated(command.contentId());
// 포인트 지불이 필요한 최신 컨텐츠인지 검증
public boolean verifyPaymentForRecentContent(Long contentId, Long userId) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기 예외들 pointPublicController 의 스웨거에 반영해주시면 좋을 것 같아요

@mooncw
Copy link
Collaborator Author

mooncw commented Nov 27, 2024

@tigris24
리플 확인해주세요

- ContentReader find 네이밍 변경
- 스웨거 예외응답 예시 추가
@mooncw mooncw merged commit 0febdc3 into dev Nov 27, 2024
@mooncw mooncw deleted the refactor/#451/content-detail-point branch November 27, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌚 BE 🏀 CW Moon Chanwook ✨ FEAT 기능 개발 🔖 HIGH Priority: HIGH ⚒️ REFACTOR 리팩토링 ✅ TEST 테스트 관련
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants