diff --git a/src/main/java/swyp/swyp6_team7/profile/repository/VisitedCountryLogCustomRepositoryImpl.java b/src/main/java/swyp/swyp6_team7/profile/repository/VisitedCountryLogCustomRepositoryImpl.java index 3390efd2..07c68b55 100644 --- a/src/main/java/swyp/swyp6_team7/profile/repository/VisitedCountryLogCustomRepositoryImpl.java +++ b/src/main/java/swyp/swyp6_team7/profile/repository/VisitedCountryLogCustomRepositoryImpl.java @@ -68,7 +68,9 @@ public List findVisitedCountriesWithStartDate(Integer userNumber) { .select( country.countryName, country.continent, - country + country, + travel.endDate + ) .from(travel) .join(travel.location, location) @@ -84,7 +86,8 @@ public List findVisitedCountriesWithStartDate(Integer userNumber) { .select( country.countryName, country.continent, - country + country, + travel.endDate ) .from(companion) .join(companion.travel, travel) diff --git a/src/main/java/swyp/swyp6_team7/profile/service/ProfileService.java b/src/main/java/swyp/swyp6_team7/profile/service/ProfileService.java index 5e7b4ac2..64cf17af 100644 --- a/src/main/java/swyp/swyp6_team7/profile/service/ProfileService.java +++ b/src/main/java/swyp/swyp6_team7/profile/service/ProfileService.java @@ -95,12 +95,13 @@ public Optional getUserByUserNumber(Integer userNumber) { public ProfileViewResponse getProfileView(Integer userNumber) { try { log.info("내 프로필 조회 시작 - userNumber: {}", userNumber); + Users user = userRepository.findUserWithTags(userNumber) + .orElseThrow(() -> new IllegalArgumentException("사용자를 찾을 수 없습니다.")); + Integer visitedCountryCount=visitedCountryLogService.calculateVisitedCountryCount(userNumber); //TODO Integer travelBadgeCount=0; - Users user = userRepository.findUserWithTags(userNumber) - .orElseThrow(() -> new IllegalArgumentException("사용자를 찾을 수 없습니다.")); return new ProfileViewResponse(user, visitedCountryCount, travelBadgeCount); } catch (Exception e) { log.error("내 프로필 조회 중 에러 발생 - userNumber: {}", userNumber, e);