diff --git a/src/main/java/com/swygbro/trip/backend/domain/admin/controller/AdminCommandController.java b/src/main/java/com/swygbro/trip/backend/domain/admin/controller/AdminCommandController.java index 008407a..ca71a1f 100644 --- a/src/main/java/com/swygbro/trip/backend/domain/admin/controller/AdminCommandController.java +++ b/src/main/java/com/swygbro/trip/backend/domain/admin/controller/AdminCommandController.java @@ -12,6 +12,7 @@ import com.swygbro.trip.backend.domain.review.dto.UpdateReviewRequest; import com.swygbro.trip.backend.domain.user.application.UserService; import com.swygbro.trip.backend.domain.user.domain.User; +import com.swygbro.trip.backend.domain.user.dto.UpdateUserRequest; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.MediaType; @@ -32,6 +33,12 @@ public class AdminCommandController { private final ReservationService reservationService; private final ReviewService reviewService; + @PutMapping(value = "/users/{userId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + public void updateUserByAdmin(@PathVariable Long userId, + @RequestPart @Valid UpdateUserRequest dto, + @RequestPart(required = false) MultipartFile imageFile) { + userService.updateUser(userId, dto, imageFile); + } @PostMapping(value = "/guideProducts", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public void createGuideProduct(String nickname, diff --git a/src/main/java/com/swygbro/trip/backend/domain/user/domain/UserDaoImpl.java b/src/main/java/com/swygbro/trip/backend/domain/user/domain/UserDaoImpl.java index 0e16dea..e55ac67 100644 --- a/src/main/java/com/swygbro/trip/backend/domain/user/domain/UserDaoImpl.java +++ b/src/main/java/com/swygbro/trip/backend/domain/user/domain/UserDaoImpl.java @@ -248,7 +248,7 @@ public Optional getUserInfoCard(Long userId) { .select(qReview.count(), qReview.rating.avg()) .from(qReview) .where(qReview.reviewer.eq(user)) - .groupBy(qUser) + .groupBy(qReview.reviewer) .fetchFirst(); long myReviewCount = 0; float myReviewRatingAvg = 0.0f; @@ -262,6 +262,13 @@ public Optional getUserInfoCard(Long userId) { .email(user.getEmail()) .nickname(user.getNickname()) .profileImageUrl(user.getProfileImageUrl()) + .nationality(user.getNationality()) + .profile(user.getProfile()) + .phone(user.getPhone()) + .location(user.getLocation()) + .birthdate(user.getBirthdate()) + .signUpType(user.getSignUpType()) + .languages(user.getUserLanguages().stream().map(UserLanguage::getLanguage).toList()) .guideProductCount(guideProductCount) .guideProductReservationCount(guideProductReservationCount) .guideProductReviewRatingAvg(guideProductReviewRatingAvg)