Skip to content

refactor: 포인트 도메인 리펙토링#231

Merged
jun23314 merged 22 commits intodevelopfrom
refactor/#221_point
Mar 28, 2025
Merged

refactor: 포인트 도메인 리펙토링#231
jun23314 merged 22 commits intodevelopfrom
refactor/#221_point

Conversation

@Seungcode
Copy link
Collaborator

#️⃣연관된 이슈

📝작업 내용

#221

@Seungcode Seungcode added the 🔧 Refactor 기능 고도화, 리팩토링을 진행할 때 사용합니다 label Mar 18, 2025
@Seungcode Seungcode self-assigned this Mar 18, 2025
@Seungcode Seungcode linked an issue Mar 18, 2025 that may be closed by this pull request
3 tasks
@github-actions
Copy link

github-actions bot commented Mar 18, 2025

Test Results

18 tests   - 14   13 ✅  - 19   5s ⏱️ -2s
18 suites  - 15    0 💤 ± 0 
18 files    - 15    5 ❌ + 5 

For more details on these failures, see this check.

Results for commit 5d74eb8. ± Comparison against base commit c7f09d8.

This pull request removes 14 tests.
com.kau.capstone.domain.food.controller.FoodControllerTest$getFoodsInfo_성공_테스트 ‑ 사료 목록을 확인할 수 있다
com.kau.capstone.domain.food.controller.FoodControllerTest$payFoodWithPoints_성공_테스트 ‑ 사료 결제시 포인트가 차감되어야 한다
com.kau.capstone.domain.food.controller.FoodControllerTest$payFoodWithPoints_실패_테스트 ‑ 사료 결제할 포인트가 부족하면 에러가 나와야 한다
com.kau.capstone.domain.member.controller.MemberControllerTest$getMemberInfo_성공_테스트 ‑ 유저 정보를 조회한다
com.kau.capstone.domain.member.controller.MemberControllerTest$getOwnerPets_성공_테스트 ‑ 사용자가 등록한 반려동물 목록을 볼 수 있다
com.kau.capstone.domain.member.controller.MemberControllerTest$putMemberInfo_성공_테스트 ‑ 유저 정보를 수정할 수 있다
com.kau.capstone.domain.point.controller.PointControllerTest$depositWithPoints_성공_테스트 ‑ 유저가 포인트를 획득할 수 있다
com.kau.capstone.domain.point.controller.PointControllerTest$getPointHistory_성공_테스트 ‑ 사용자 A는 사용자 B의 포인트 내역을 보지 못해야 한다
com.kau.capstone.domain.point.controller.PointControllerTest$getPointHistory_성공_테스트 ‑ 사용자가 사료 주문시 사료 결제 내역을 볼 수 있다
com.kau.capstone.domain.point.controller.PointControllerTest$getPointHistory_성공_테스트 ‑ 사용자는 자신의 포인트 내역을 최신순으로 볼 수 있다
…

♻️ This comment has been updated with latest results.

@Seungcode Seungcode changed the title refactor: 백신 도메인 리펙토링 refactor: 포인트 도메인 리펙토링 Mar 19, 2025
@Entity
@Getter
@Builder
@AllArgsConstructor
Copy link
Contributor

Choose a reason for hiding this comment

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

얘도 없애주세요~

default HistoryListResV2 findHistoryListByMember(Member member){
List<History> res = findHistoriesByMember(member);
return HistoryListResV2.of(res);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Exception 처리를 해주지 않는데, default로 선언하고 여기서 List에 값을 넣는 작업까지 해주는 이유가 있나요?
한번에 List<History> res = findHistoriesByMember(member) 로 해주면 안되나요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

서비스계층은 어떤 작업을 할건지 흐름이 보이는 것만 했으면 좋겠는데 엔티티를 가져와서 dto로 만드는 과정이 거기 들어가는 것보다 레포단에서 해주고 넘겨야한다고 생각해서 한 번 더 감싸서 dto로 리턴해줬습니다.

public interface PointRepository extends JpaRepository<Point, Long> {

@Query("SELECT p FROM Point p WHERE p.member = :member")
Optional<Point> findByMember(@Param("member") Member member);
Copy link
Contributor

Choose a reason for hiding this comment

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

얘는 왜 Optional 써요

import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
Copy link
Contributor

Choose a reason for hiding this comment

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

Transactional이 Service 위에 있는 이유가 있나요?
Get의 경우 @Transactional(readonly)로 해두는게 성능상 좋다고 해서 그렇게 사용하고 있었는데, 위와 같이 코딩한(?) 이유가 궁금합니다

@jun23314 jun23314 merged commit ff5a9c8 into develop Mar 28, 2025
0 of 4 checks passed
@jun23314 jun23314 deleted the refactor/#221_point branch March 28, 2025 11:05
2dhhh pushed a commit that referenced this pull request May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔧 Refactor 기능 고도화, 리팩토링을 진행할 때 사용합니다

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] 포인트 도메인 리팩토링

2 participants