Skip to content

Commit

Permalink
fix: 참여자 이름 변경시 지출 상세 이름 변경 안되는 버그 수정 (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arachneee authored Aug 22, 2024
1 parent eb919a6 commit 89a7a47
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import server.haengdong.application.response.EventDetailAppResponse;
import server.haengdong.application.response.MembersAppResponse;
import server.haengdong.domain.action.BillAction;
import server.haengdong.domain.action.BillActionDetailRepository;
import server.haengdong.domain.action.BillActionRepository;
import server.haengdong.domain.action.MemberAction;
import server.haengdong.domain.action.MemberActionRepository;
Expand All @@ -35,6 +36,7 @@ public class EventService {
private final EventTokenProvider eventTokenProvider;
private final BillActionRepository billActionRepository;
private final MemberActionRepository memberActionRepository;
private final BillActionDetailRepository billActionDetailRepository;

@Transactional
public EventAppResponse saveEvent(EventAppRequest request) {
Expand Down Expand Up @@ -149,6 +151,8 @@ private void validateAfterMemberNameNotExist(Event event, String afterName) {
private void updateMemberName(Event event, String beforeName, String afterName) {
memberActionRepository.findAllByAction_EventAndMemberName(event, beforeName)
.forEach(memberAction -> memberAction.updateMemberName(afterName));
billActionDetailRepository.findAllByMemberName(beforeName)
.forEach(billActionDetail -> billActionDetail.updateMemberName(afterName));
}

public void validatePassword(EventLoginAppRequest request) throws HaengdongException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public void updateIsFixed(boolean isFixed) {
this.isFixed = isFixed;
}

public void updateMemberName(String name) {
this.memberName = name;
}

public boolean hasMemberName(String memberName) {
return this.memberName.equals(memberName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ public interface BillActionDetailRepository extends JpaRepository<BillActionDeta
where bd.billAction = :billAction
""")
List<BillActionDetail> findAllByBillAction(BillAction billAction);

List<BillActionDetail> findAllByMemberName(String memberName);
}

0 comments on commit 89a7a47

Please sign in to comment.