Skip to content

비즈니스 로직 가독성을 위한 도메인 전용 레이어 추가-transfer#228

Merged
chungjeongsu merged 19 commits into
developfrom
refactor/transfer
Apr 26, 2026
Merged

비즈니스 로직 가독성을 위한 도메인 전용 레이어 추가-transfer#228
chungjeongsu merged 19 commits into
developfrom
refactor/transfer

Conversation

@chungjeongsu

Copy link
Copy Markdown
Contributor

No description provided.

@chungjeongsu chungjeongsu self-assigned this Apr 26, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a comprehensive transfer and settlement system, including new domain entities, application services, and REST endpoints. The system is integrated into the travel itinerary lifecycle to manage financial settlements among members. Review feedback highlights a potential data inconsistency issue when updating total amounts without member breakdowns, suggests standardizing error codes for user resolution failures, and recommends maintaining database-level foreign key constraints for better data integrity.

Comment on lines +68 to +71
transfer.changeAccountNumber(accountNumber);
transfer.changeBankName(bankName);
transfer.changeAccountHolder(accountHolder);
transfer.changeTotalAmount(totalAmount);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

memberAmountByUserIdnull인 경우(즉, 요청에 멤버별 금액 목록이 없는 경우)에도 totalAmount를 직접 수정할 수 있도록 구현되어 있습니다. 이 경우 기존 멤버들의 금액 합계와 전체 totalAmount가 일치하지 않는 데이터 불일치 상태가 발생할 수 있습니다. totalAmount 수정은 멤버별 금액 목록이 함께 제공될 때만 허용하거나, 기존 멤버 금액 합계와 일치하는지 검증하는 로직이 추가되어야 합니다.

private Long resolveMemberUserIdOrThrow(final String encryptedUserId) {
Long memberUserId = userIdentityResolver.resolve(encryptedUserId);
if (memberUserId == null) {
throw new BusinessException(TransferErrorCode.INVALID_TRANSFER_MEMBER);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

UUID 해석 실패 시 TransferErrorCode.INVALID_TRANSFER_MEMBER를 던지고 있습니다. TravelUseCase 등 프로젝트 내 다른 곳에서는 동일한 상황에서 UserErrorCode.USER_NOT_FOUND를 사용하고 있으므로, 에러 응답의 일관성을 위해 에러 코드를 통일하는 것을 권장합니다.

Suggested change
throw new BusinessException(TransferErrorCode.INVALID_TRANSFER_MEMBER);
throw new BusinessException(org.triple.backend.user.exception.UserErrorCode.USER_NOT_FOUND);

private User creator;

@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "travel_itinerary_id", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)를 사용하여 외래 키 제약 조건을 비활성화하셨습니다. 특별한 기술적 제약 사항이 없다면, 데이터 무결성을 보장하기 위해 데이터베이스 수준의 제약 조건을 유지하는 것이 좋습니다.

Suggested change
@JoinColumn(name = "travel_itinerary_id", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
@JoinColumn(name = "travel_itinerary_id")

@chungjeongsu chungjeongsu merged commit 9a01121 into develop Apr 26, 2026
1 check passed
@chungjeongsu chungjeongsu deleted the refactor/transfer branch April 26, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants