From 1434b26a328d6665b9dc0b46f53ca4661bd1f69e Mon Sep 17 00:00:00 2001 From: eunhee Date: Tue, 5 Dec 2023 20:04:04 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=EA=B3=84=EC=A2=8C=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EB=AC=B8=EC=A0=9C=20=EC=98=A4=EB=A5=98=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 --- .../user/adapter/out/persistence/UserMapper.java | 1 - .../out/persistence/UserPersistenceAdapter.java | 11 +++++++---- .../port/out/FindHouseholdUserListPort.java | 2 ++ .../service/GetUserAccountService.java | 16 ++++------------ 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/connect/accountApp/domain/user/adapter/out/persistence/UserMapper.java b/src/main/java/com/connect/accountApp/domain/user/adapter/out/persistence/UserMapper.java index 2882883..b919ed8 100644 --- a/src/main/java/com/connect/accountApp/domain/user/adapter/out/persistence/UserMapper.java +++ b/src/main/java/com/connect/accountApp/domain/user/adapter/out/persistence/UserMapper.java @@ -59,7 +59,6 @@ private HouseHoldJpaEntity getHouseHoldJpaEntityOfUser(Household household) { } private Household getHouseHoldOfUserJpaEntity(HouseHoldJpaEntity houseHoldJpaEntity) { - if (houseHoldJpaEntity == null || houseHoldJpaEntity instanceof HibernateProxy) { System.out.println("hello1"); return null; diff --git a/src/main/java/com/connect/accountApp/domain/user/adapter/out/persistence/UserPersistenceAdapter.java b/src/main/java/com/connect/accountApp/domain/user/adapter/out/persistence/UserPersistenceAdapter.java index 3d5de27..c870a2f 100644 --- a/src/main/java/com/connect/accountApp/domain/user/adapter/out/persistence/UserPersistenceAdapter.java +++ b/src/main/java/com/connect/accountApp/domain/user/adapter/out/persistence/UserPersistenceAdapter.java @@ -1,6 +1,7 @@ package com.connect.accountApp.domain.user.adapter.out.persistence; import com.connect.accountApp.domain.household.adapter.out.persistence.HouseholdMapper; +import com.connect.accountApp.domain.household.adapter.out.persistence.jpa.model.HouseHoldJpaEntity; import com.connect.accountApp.domain.household.domain.model.Household; import com.connect.accountApp.domain.user.adapter.out.persistence.jpa.model.UserJpaEntity; import com.connect.accountApp.domain.user.adapter.out.persistence.jpa.UserQueryRepository; @@ -55,10 +56,6 @@ public Boolean userExist(String email) { public User findUserWithHousehold(String userEmail) { UserJpaEntity userJpaEntity = userQueryRepository.findUserJpaEntityWithHouseholdByEmail(userEmail); - - System.out.println( - "userJpaEntity.getHouseHoldJpaEntity().getHouseholdId() = " + userJpaEntity.getHouseHoldJpaEntity() - .getHouseholdId()); return userMapper.mapToDomainEntity(userJpaEntity); } @@ -86,6 +83,12 @@ public List findHouseholdMembers(Long householdId) { .map(userMapper::mapToDomainEntity).toList(); } + @Override + public Long findHouseholdId(String userEmail) { + UserJpaEntity userJpaEntity = userQueryRepository.findUserJpaEntityWithHouseholdByEmail(userEmail); + return userJpaEntity.getHouseHoldJpaEntity().getHouseholdId(); + } + @Override public void save(User user) { UserJpaEntity userJpaEntity = userMapper.mapToJpaEntity(user); diff --git a/src/main/java/com/connect/accountApp/domain/user/application/port/out/FindHouseholdUserListPort.java b/src/main/java/com/connect/accountApp/domain/user/application/port/out/FindHouseholdUserListPort.java index 42719f1..277a919 100644 --- a/src/main/java/com/connect/accountApp/domain/user/application/port/out/FindHouseholdUserListPort.java +++ b/src/main/java/com/connect/accountApp/domain/user/application/port/out/FindHouseholdUserListPort.java @@ -10,4 +10,6 @@ public interface FindHouseholdUserListPort { List findHouseholdMembers(Long householdId); + Long findHouseholdId(String userEmail); + } diff --git a/src/main/java/com/connect/accountApp/domain/user/application/service/GetUserAccountService.java b/src/main/java/com/connect/accountApp/domain/user/application/service/GetUserAccountService.java index 8ec70e7..729902f 100644 --- a/src/main/java/com/connect/accountApp/domain/user/application/service/GetUserAccountService.java +++ b/src/main/java/com/connect/accountApp/domain/user/application/service/GetUserAccountService.java @@ -25,17 +25,9 @@ public User getUserAccount(String userEmail) { @Override public List getMembersAccount(String userEmail) { - System.out.println("userEmail = " + userEmail); - User user = getUserPort.findUserWithHousehold(userEmail); - System.out.println("user = " + user.getUserId()); - System.out.println("user = " + user.getUserAccount()); - System.out.println("user = " + user.getUserNickname()); - System.out.println("user = " + user.getHousehold()); - - System.out.println("user.getHousehold()1 = " + user.getHousehold()); -// List householdMembers = findHouseholdUserListPort.findHouseholdMembers(); - -// System.out.println("householdMembers.size() = " + householdMembers.size()); - return findHouseholdUserListPort.findHouseholdMembers(user.getHousehold().getHouseholdId()); + + Long householdId = findHouseholdUserListPort.findHouseholdId(userEmail); + + return findHouseholdUserListPort.findHouseholdMembers(householdId); } }