Skip to content

Commit 05bca03

Browse files
authored
Merge pull request #128 from UMCWegg/feature/#9
FEAT: [#9] 친구 팔로우/팔로잉 화면에 친구 userId 필드 추가, 홈(주간) 렌더링 시 장소이름 제대로 불러오도…
2 parents c923fec + 62c2be1 commit 05bca03

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

src/main/java/umc/wegg/dto/HomeResponseDTO.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,17 @@ public static class FollowResponseDTO {
5858
private int followerCount; // 팔로워 수
5959
private int followingCount; // 팔로잉 수
6060
private String profileImage; // 프로필 사진
61-
private String accountId; // 사용자 계정 ID
62-
private FollowStatus followStatus; // ✅ 친구 홈에서만 추가될 필드
61+
private String accountId; // 사용자 계정 이름
62+
private Long userId; // 사용자 계정 아이디
63+
private FollowStatus followStatus; // 친구 홈에서만 추가될 필드
6364

6465
// 본인 홈에서 사용하는 생성자 (팔로우 상태 없음)
6566
public FollowResponseDTO(int followerCount, int followingCount, String profileImage, String accountId) {
6667
this.followerCount = followerCount;
6768
this.followingCount = followingCount;
6869
this.profileImage = profileImage;
6970
this.accountId = accountId;
71+
this.userId = userId;
7072
this.followStatus = null; // 본인 홈에서는 팔로우 상태 없음
7173
}
7274
}

src/main/java/umc/wegg/service/HomeService/HomeCommandServiceImpl.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ public HomeResponseDTO.HomeWeekResponseDTO getHomeWeekData(AuthenticatedUser aut
6464
// 일정 및 게시물 조회
6565
Plan plan = allPlans.stream()
6666
.filter(p -> p.getStartTime().toLocalDate().equals(currentDate))
67-
.min(Comparator.comparing(Plan::getStartTime)) // 📌 가장 빠른 일정 선택
67+
.min(Comparator.comparing(Plan::getStartTime)) // 가장 빠른 일정 선택
6868
.orElse(null);
6969

7070
Post post = allPosts.stream()
7171
.filter(p -> p.getCreatedAt().toLocalDate().equals(currentDate))
72-
.min(Comparator.comparing(Post::getCreatedAt)) // 📌 첫 게시물 선택
72+
.min(Comparator.comparing(Post::getCreatedAt)) // 첫 게시물 선택
7373
.orElse(null);
7474

7575
HomeResponseDTO.PlanInfo planInfo = (plan != null)
@@ -141,14 +141,14 @@ else if (currentDate.equals(today)) {
141141

142142
// startTime 5분 전부터 + 지각 허용 시간까지 upcomingPlanAddress 포함
143143
if (now.isAfter(planStartTime.minusMinutes(5)) && now.isBefore(planLateTime)) {
144-
upcomingPlanAddress = activePlan.getAddress().getAddress();
144+
upcomingPlanAddress = activePlan.getAddress().getPlaceName();
145145
planId = activePlan.getId();
146146
}
147147

148148
// 랜덤 타임이 설정된 경우 5분 전부터 randomTime까지 포함
149149
if (planRandomTime != null) {
150150
if (now.isAfter(planRandomTime.minusMinutes(5)) && now.isBefore(planRandomTime)) {
151-
upcomingPlanAddress = activePlan.getAddress().getAddress();
151+
upcomingPlanAddress = activePlan.getAddress().getPlaceName();
152152
planId = activePlan.getId();
153153
}
154154
}
@@ -158,15 +158,15 @@ else if (currentDate.equals(today)) {
158158

159159
// startTime 5분 전부터 + 지각 허용 시간까지 upcomingPlanAddress 포함
160160
if (now.isAfter(planStartTime.minusMinutes(5)) && now.isBefore(planLateTime)) {
161-
upcomingPlanAddress = closestPlan.getAddress().getAddress();
161+
upcomingPlanAddress = closestPlan.getAddress().getPlaceName();
162162
planId = closestPlan.getId();
163163
}
164164

165165
// 랜덤 타임이 설정된 경우 5분 전부터 randomTime까지 포함
166166
LocalDateTime planRandomTime = closestPlan.getRandomTime();
167167
if (planRandomTime != null) {
168168
if (now.isAfter(planRandomTime.minusMinutes(5)) && now.isBefore(planRandomTime)) {
169-
upcomingPlanAddress = closestPlan.getAddress().getAddress();
169+
upcomingPlanAddress = closestPlan.getAddress().getPlaceName();
170170
planId = closestPlan.getId();
171171
}
172172
}
@@ -202,7 +202,7 @@ else if (currentDate.equals(today)) {
202202
public HomeResponseDTO.HomeMonthResponseDTO getHomeMonthData(AuthenticatedUser authenticatedUser) {
203203
Long userId = authenticatedUser.getUserId(); // 로그인된 사용자 ID
204204
LocalDate today = LocalDate.now();
205-
// 본인의 월간 데이터를 조회할 때만 Egg 상태 초기화 실행
205+
// 본인의 월간 데이터를 조회할 때만 Egg 상태 초기화 실행
206206
HomeResponseDTO.HomeMonthResponseDTO response = getMonthData(userId, today.getYear(), today.getMonthValue());
207207
eggService.scheduleResetEggStatus(userId);
208208

@@ -240,13 +240,13 @@ public HomeResponseDTO.FollowResponseDTO getFriendHomeFollowData(Long userId, Au
240240
// 현재 로그인한 사용자 ID
241241
Long currentUserId = authenticatedUser.getUserId();
242242

243-
// 현재 사용자(User)와 친구(User) 객체 가져오기
243+
// 현재 사용자(User)와 친구(User) 객체 가져오기
244244
User currentUser = userRepository.findById(currentUserId)
245245
.orElseThrow(() -> new IllegalArgumentException("현재 사용자를 찾을 수 없습니다."));
246246
User friendUser = userRepository.findById(userId)
247247
.orElseThrow(() -> new IllegalArgumentException("친구 사용자를 찾을 수 없습니다."));
248248

249-
// 현재 사용자와 친구의 팔로우 상태 조회
249+
// 현재 사용자와 친구의 팔로우 상태 조회
250250
Follow follow = followRepository.findByFollowerAndFollowee(currentUser, friendUser)
251251
.orElse(null); // 해당 팔로우 관계가 없으면 null 반환
252252

@@ -266,7 +266,8 @@ public HomeResponseDTO.FollowResponseDTO getFriendHomeFollowData(Long userId, Au
266266
baseResponse.getFollowingCount(),
267267
baseResponse.getProfileImage(),
268268
baseResponse.getAccountId(),
269-
followStatus // ✅ 친구 홈에서만 추가되는 필드
269+
userId, // 친구의 유저 아이디
270+
followStatus // 친구 홈에서만 추가되는 필드
270271
);
271272
}
272273

@@ -298,12 +299,12 @@ private HomeResponseDTO.HomeMonthResponseDTO getMonthData(Long userId, int year,
298299
// 일정 및 게시물 조회
299300
Plan plan = allPlans.stream()
300301
.filter(p -> p.getStartTime().toLocalDate().equals(currentDate))
301-
.min(Comparator.comparing(Plan::getStartTime)) // 📌 가장 빠른 일정 선택
302+
.min(Comparator.comparing(Plan::getStartTime)) // 가장 빠른 일정 선택
302303
.orElse(null);
303304

304305
Post post = allPosts.stream()
305306
.filter(p -> p.getCreatedAt().toLocalDate().equals(currentDate))
306-
.min(Comparator.comparing(Post::getCreatedAt)) // 📌 첫 게시물 선택
307+
.min(Comparator.comparing(Post::getCreatedAt)) // 첫 게시물 선택
307308
.orElse(null);
308309

309310
HomeResponseDTO.PlanInfo planInfo = (plan != null)

0 commit comments

Comments
 (0)