From 37a10c85d060f262ddf88f21b636f630235350f2 Mon Sep 17 00:00:00 2001 From: rlaisqls Date: Thu, 16 Nov 2023 01:38:49 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20favorite=20join=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../question/persistence/repository/QuestionsRepository.kt | 3 ++- .../kr/hs/dsm/inq/domain/question/service/QuestionService.kt | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/QuestionsRepository.kt b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/QuestionsRepository.kt index 4c91e85..698865c 100644 --- a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/QuestionsRepository.kt +++ b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/QuestionsRepository.kt @@ -157,7 +157,7 @@ class CustomQuestionRepositoryImpl( return@run leftJoin(questionTags).on(questionTags.problems.eq(questions.problem)) .leftJoin(tags).on(tags.id.eq(questionTags.id.tagId)) - .leftJoin(favorite).on(favorite.problem.id.eq(questions.problem.id)) + .leftJoin(favorite).on(favorite.problem.id.eq(questionSets.problem.id).and(favorite.user.id.eq(user.id))) .leftJoin(answers).on(answers.writer.eq(user).and(answers.questions.eq(questions))) .innerJoin(author).on(author.eq(questions.author)) .transform( @@ -198,6 +198,7 @@ class CustomQuestionRepositoryImpl( .leftJoin(tags).on(tags.id.eq(questionTags.id.tagId)) .leftJoin(answers).on(answers.questions.id.eq(questions.id)) .innerJoin(writer).on(writer.id.eq(user.id)) + .leftJoin(favorite).on(favorite.problem.id.eq(questionSets.problem.id).and(favorite.user.id.eq(user.id))) .transform( GroupBy.groupBy(questions) .list( diff --git a/src/main/kotlin/kr/hs/dsm/inq/domain/question/service/QuestionService.kt b/src/main/kotlin/kr/hs/dsm/inq/domain/question/service/QuestionService.kt index 4062d68..551b1fc 100644 --- a/src/main/kotlin/kr/hs/dsm/inq/domain/question/service/QuestionService.kt +++ b/src/main/kotlin/kr/hs/dsm/inq/domain/question/service/QuestionService.kt @@ -467,7 +467,6 @@ class QuestionService( val user = SecurityUtil.getCurrentUser() val question = questionsRepository.findByIdOrNull(questionId)?: throw QuestionNotFoundException - val post = postRepository.save(Post()) answersRepository.save(