Skip to content

Commit

Permalink
[BugFix] - 기업 상세 조회 API 버그 수정했습니다.
Browse files Browse the repository at this point in the history
[BugFix] - 기업 상세 조회 API 버그 수정했습니다.
  • Loading branch information
fakerdeft authored May 8, 2024
2 parents e54a9f5 + ed8a743 commit 68eef24
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public interface CompanyRepository extends JpaRepository<Company, Long>, Company
@Query("""
SELECT c
FROM Company c
JOIN FETCH c.questions
WHERE c.id = :companyId
AND c.companyStatus = 'REGISTRATION'
""")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public Optional<Page<Question>> findRegisteredQuestionsById(
CompletableFuture<List<Question>> questionsFuture = CompletableFuture.supplyAsync(() ->
jpaQueryFactory
.selectFrom(question)
.leftJoin(question.answers).fetchJoin()
.where(
question.company.id.eq(companyId),
question.questionStatus.eq(true),
Expand All @@ -72,6 +73,7 @@ public Optional<Page<Question>> findRegisteredQuestionsById(
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.orderBy(makeOrderSpecifiers(question, pageable))
.distinct()
.fetch()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public interface QuestionRepository extends JpaRepository<Question, Long>, Quest
@Query("""
SELECT q
FROM Question q
JOIN FETCH q.answers
WHERE q.member.id = :memberId
AND q.questionStatus = true
ORDER BY q.createdAt DESC
Expand All @@ -29,6 +30,7 @@ Optional<Page<Question>> findRegisteredQuestionsByMemberId(
@Query("""
SELECT DISTINCT q
FROM Question q
JOIN FETCH q.answers
WHERE q.id = :questionId
AND q.questionStatus = true
""")
Expand Down

0 comments on commit 68eef24

Please sign in to comment.