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

[BE] 참여자 이름 변경시 지출 상세 이름 변경 안되는 버그 수정 #498

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
Loading