From e3eba7c76d077766d5aeeb6297b7649539bfad6b Mon Sep 17 00:00:00 2001 From: Arachneee Date: Fri, 23 Aug 2024 00:45:29 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=B0=B8=EC=97=AC=EC=9E=90=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20=EB=B3=80=EA=B2=BD=EC=8B=9C=20=EC=A7=80=EC=B6=9C=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EC=95=88=EB=90=98=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/server/haengdong/application/EventService.java | 4 ++++ .../java/server/haengdong/domain/action/BillActionDetail.java | 4 ++++ .../haengdong/domain/action/BillActionDetailRepository.java | 2 ++ 3 files changed, 10 insertions(+) diff --git a/server/src/main/java/server/haengdong/application/EventService.java b/server/src/main/java/server/haengdong/application/EventService.java index 834c0e10a..6b4cb755f 100644 --- a/server/src/main/java/server/haengdong/application/EventService.java +++ b/server/src/main/java/server/haengdong/application/EventService.java @@ -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; @@ -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) { @@ -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 { diff --git a/server/src/main/java/server/haengdong/domain/action/BillActionDetail.java b/server/src/main/java/server/haengdong/domain/action/BillActionDetail.java index ad13e6ab2..ffdfe04a3 100644 --- a/server/src/main/java/server/haengdong/domain/action/BillActionDetail.java +++ b/server/src/main/java/server/haengdong/domain/action/BillActionDetail.java @@ -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); } diff --git a/server/src/main/java/server/haengdong/domain/action/BillActionDetailRepository.java b/server/src/main/java/server/haengdong/domain/action/BillActionDetailRepository.java index d1d7cfe0f..17a082657 100644 --- a/server/src/main/java/server/haengdong/domain/action/BillActionDetailRepository.java +++ b/server/src/main/java/server/haengdong/domain/action/BillActionDetailRepository.java @@ -14,4 +14,6 @@ public interface BillActionDetailRepository extends JpaRepository findAllByBillAction(BillAction billAction); + + List findAllByMemberName(String memberName); }