From f8b279d8fb85c277181294a92868a6174661f989 Mon Sep 17 00:00:00 2001 From: rlaisqls Date: Tue, 31 Oct 2023 20:59:57 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B9=8C=EB=93=9C=20=EC=98=A4=EB=A5=98?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/question/persistence/QuestionSets.kt | 6 +++--- .../repository/QuestionSetsRepository.kt | 8 ++++---- .../inq/domain/question/service/QuestionService.kt | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/QuestionSets.kt b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/QuestionSets.kt index 6e12167..5449abf 100644 --- a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/QuestionSets.kt +++ b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/QuestionSets.kt @@ -32,13 +32,13 @@ class QuestionSets ( @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "post_id", columnDefinition = "BIGINT",nullable = false) - var postId: Post, + var post: Post, @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "problem_id", columnDefinition = "BIGINT", nullable = false) - var problemId: Problem, + var problem: Problem, @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "author_id", columnDefinition = "BIGINT", nullable = false) - val authorId: User, + val author: User, ) \ No newline at end of file diff --git a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/QuestionSetsRepository.kt b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/QuestionSetsRepository.kt index 5b49150..f175045 100644 --- a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/QuestionSetsRepository.kt +++ b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/QuestionSetsRepository.kt @@ -87,11 +87,11 @@ class CustomQuestionSetsRepositoryImpl( private fun JPAQuery.getQuestionSetDto(user: User): MutableList { val author = QUser("writer") - return leftJoin(questionTags).on(questionTags.problems.eq(questionSets.problemId)) + return leftJoin(questionTags).on(questionTags.problems.eq(questionSets.problem)) .leftJoin(tags).on(tags.id.eq(questionTags.id.tagId)) .leftJoin(questionSolvingHistory) - .on(questionSolvingHistory.userId.id.eq(user.id)).on(questionSolvingHistory.problem.eq(questionSets.problemId)) - .innerJoin(author).on(author.id.eq(questionSets.authorId.id)) + .on(questionSolvingHistory.userId.id.eq(user.id)).on(questionSolvingHistory.problem.eq(questionSets.problem)) + .innerJoin(author).on(author.id.eq(questionSets.author.id)) // .rightJoin(favorite).on(favorite.questions.id.eq(questions.id)) // .rightJoin(answers).on(answers.writer.eq(user).and(answers.questions.eq(questions))) .transform( @@ -119,7 +119,7 @@ class CustomQuestionSetsRepositoryImpl( val author = QUser("writer") val liked = QLike("liked") val favorite = QFavorite("favorite") - return@run leftJoin(questionTags).on(questionTags.problems.eq(questionSets.problemId)) + return@run leftJoin(questionTags).on(questionTags.problems.eq(questionSets.problem)) .leftJoin(tags).on(tags.id.eq(questionTags.id.tagId)) .innerJoin(author).on(author.id.eq(questionSets.author.id)) .leftJoin(liked).on(liked.id.userId.eq(user.id)).on(liked.post.eq(questionSets.post)) 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 ae6f712..9f55efc 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 @@ -288,8 +288,8 @@ class QuestionService( fun registerQuestionSet(request: QuestionSetsRequest): RegisterQuestionSetsResponse{ val user = SecurityUtil.getCurrentUser() - val postId = postRepository.save(Post()) - val problemId = problemRepository.save(Problem(type = ProblemType.SET)) + val post = postRepository.save(Post()) + val problem = problemRepository.save(Problem(type = ProblemType.SET)) val sets = questionSetsRepository.save( QuestionSets( @@ -298,16 +298,16 @@ class QuestionService( category = request.category, likeCount = 0, viewCount = 0, - postId = postId, - problemId = problemId, - authorId = user, + post = post, + problem = problem, + author = user, ) ) saveTag( category = request.category, tags = request.tag, - problems = sets.problemId + problems = sets.problem ) val questions = questionsRepository.findByIdIn(request.questionId) @@ -386,7 +386,7 @@ class QuestionService( questionSolvingHistoryRepository.save( QuestionSolvingHistory( userId = user, - problem = questionSet.problemId + problem = questionSet.problem ) ) }