diff --git a/src/main/java/com/flickspick/rec/application/RecService.java b/src/main/java/com/flickspick/rec/application/RecService.java index 2ec024f..26defb1 100644 --- a/src/main/java/com/flickspick/rec/application/RecService.java +++ b/src/main/java/com/flickspick/rec/application/RecService.java @@ -10,6 +10,7 @@ import com.flickspick.rec.dto.RecResponse; import com.flickspick.recommendtype.application.RecommendTypeService; import com.flickspick.recommendtype.model.RecTypeModel; +import com.flickspick.user.application.UserService; import com.flickspick.user_movie_history.application.UserMovieHistoryService; import com.flickspick.user_movie_history.domain.UserMovieHistory; import lombok.RequiredArgsConstructor; @@ -29,9 +30,12 @@ public class RecService { private final RecommendTypeService recommendTypeService; private final MovieService movieService; private final MovieRecommendTypeRepository movieRecommendTypeRepository; + private final UserService userService; @SneakyThrows public RecResponse get(AuthUser user, RecRequest request) { + var userModel = userService.getUserModel(user.getId()); + Random rand = new SecureRandom(); Map questionAndAnswer = request.getAnswers() .stream() @@ -57,6 +61,6 @@ public RecResponse get(AuthUser user, RecRequest request) { userMovieHistoryService.saveUserMovieHistory(userMovieHistory); - return RecResponse.toResponse(recTypeModel, movieModel, recMovies); + return RecResponse.toResponse(recTypeModel, movieModel, recMovies, userModel); } } diff --git a/src/main/java/com/flickspick/rec/dto/RecResponse.java b/src/main/java/com/flickspick/rec/dto/RecResponse.java index e359af7..a772f7b 100644 --- a/src/main/java/com/flickspick/rec/dto/RecResponse.java +++ b/src/main/java/com/flickspick/rec/dto/RecResponse.java @@ -2,6 +2,7 @@ import com.flickspick.movie.model.MovieModel; import com.flickspick.recommendtype.model.RecTypeModel; +import com.flickspick.user.model.UserModel; import lombok.AllArgsConstructor; import lombok.Data; @@ -10,15 +11,17 @@ @Data @AllArgsConstructor public class RecResponse { + private UserModel user; private RecTypeModel recType; private MovieModel movie; private List recMovies; - public static RecResponse toResponse(RecTypeModel recTypeModel, MovieModel movie, List recMovies) { - return new RecResponse( - recTypeModel, - movie, - recMovies - ); + public static RecResponse toResponse( + RecTypeModel recTypeModel, + MovieModel movie, + List recMovies, + UserModel user + ) { + return new RecResponse(user, recTypeModel, movie, recMovies); } }