-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Q&A 관련 인프라 리팩토링 #686
Merged
Merged
Q&A 관련 인프라 리팩토링 #686
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b3cf424
feat: 도메인 영역에 질문 repository 추가
JJ503 19f99f5
refactor: EntityGraph를 jpql로 변경
JJ503 af41d6a
refactor: 사용하지 않는 클래스 제거
JJ503 ff3fc35
refactor: 잘못된 쿼리문 수정
JJ503 d29d1ec
feat: 도메인 영역에 질문 repository 구현체 추가
JJ503 a066181
refactor: service에서 도메인 영역의 질문 repository를 사용하도록 변경
JJ503 1adb983
test: 테스트에서 도메인 영역의 질문 repository를 사용하도록 변경
JJ503 e7869ed
refactor: 사용하지 않는 메서드 제거
JJ503 02cdd72
refactor: 쿼리문 명령는 대문자로 수정
JJ503 f9fb8e2
feat: 도메인 영역에 답변 repository 추가
JJ503 9ffb98c
feat: 도메인 영역에 답변 repository 구현체 추가
JJ503 7a9bc17
test: 테스트에서 도메인 영역의 답변 repository를 사용하도록 변경
JJ503 972cbd8
test: 테스트 실패 문제 해결
JJ503 0f9544b
fix: 잘못된 쿼리 조건 수정
JJ503 25cad81
test: 불필요한 로직 제거
JJ503 3ba1e67
refactor: final 누락 추가
JJ503 901e3f3
ci: 브랜치 최신화
JJ503 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
backend/ddang/src/main/java/com/ddang/ddang/qna/application/dto/QuestionDto.java
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
backend/ddang/src/main/java/com/ddang/ddang/qna/domain/repository/AnswerRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.ddang.ddang.qna.domain.repository; | ||
|
||
import com.ddang.ddang.qna.domain.Answer; | ||
|
||
import java.util.Optional; | ||
|
||
public interface AnswerRepository { | ||
|
||
Answer save(final Answer answer); | ||
|
||
boolean existsByQuestionId(Long questionId); | ||
|
||
Optional<Answer> findById(final Long id); | ||
} |
15 changes: 15 additions & 0 deletions
15
backend/ddang/src/main/java/com/ddang/ddang/qna/domain/repository/QuestionRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.ddang.ddang.qna.domain.repository; | ||
|
||
import com.ddang.ddang.qna.domain.Question; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public interface QuestionRepository { | ||
|
||
Question save(final Question question); | ||
|
||
Optional<Question> findById(final Long id); | ||
|
||
List<Question> findAllByAuctionId(final Long auctionId); | ||
} |
30 changes: 30 additions & 0 deletions
30
backend/ddang/src/main/java/com/ddang/ddang/qna/infrastructure/AnswerRepositoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.ddang.ddang.qna.infrastructure; | ||
|
||
import com.ddang.ddang.qna.domain.Answer; | ||
import com.ddang.ddang.qna.domain.repository.AnswerRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.Optional; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class AnswerRepositoryImpl implements AnswerRepository { | ||
|
||
private final JpaAnswerRepository jpaAnswerRepository; | ||
|
||
@Override | ||
public Answer save(final Answer answer) { | ||
return jpaAnswerRepository.save(answer); | ||
} | ||
|
||
@Override | ||
public boolean existsByQuestionId(final Long questionId) { | ||
return jpaAnswerRepository.existsByQuestionId(questionId); | ||
} | ||
|
||
@Override | ||
public Optional<Answer> findById(final Long id) { | ||
return jpaAnswerRepository.findByIdAndDeletedIsFalse(id); | ||
} | ||
} |
11 changes: 9 additions & 2 deletions
11
backend/ddang/src/main/java/com/ddang/ddang/qna/infrastructure/JpaAnswerRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
package com.ddang.ddang.qna.infrastructure; | ||
|
||
import com.ddang.ddang.qna.domain.Answer; | ||
import org.springframework.data.jpa.repository.EntityGraph; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
|
||
import java.util.Optional; | ||
|
||
public interface JpaAnswerRepository extends JpaRepository<Answer, Long> { | ||
|
||
boolean existsByQuestionId(Long questionId); | ||
|
||
@EntityGraph(attributePaths = {"question", "question.auction", "question.auction.seller"}) | ||
@Query(""" | ||
SELECT an | ||
FROM Answer an | ||
JOIN FETCH an.question q | ||
JOIN FETCH q.auction a | ||
JOIN FETCH a.seller | ||
WHERE an.deleted = false AND a.id = :answerId | ||
""") | ||
Optional<Answer> findByIdAndDeletedIsFalse(final Long answerId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
backend/ddang/src/main/java/com/ddang/ddang/qna/infrastructure/QuestionRepositoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.ddang.ddang.qna.infrastructure; | ||
|
||
import com.ddang.ddang.qna.domain.Question; | ||
import com.ddang.ddang.qna.domain.repository.QuestionRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class QuestionRepositoryImpl implements QuestionRepository { | ||
|
||
private final JpaQuestionRepository jpaQuestionRepository; | ||
|
||
@Override | ||
public Question save(final Question question) { | ||
return jpaQuestionRepository.save(question); | ||
} | ||
|
||
@Override | ||
public Optional<Question> findById(final Long id) { | ||
return jpaQuestionRepository.findByIdAndDeletedIsFalse(id); | ||
} | ||
|
||
@Override | ||
public List<Question> findAllByAuctionId(final Long auctionId) { | ||
return jpaQuestionRepository.findAllByAuctionId(auctionId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
필수
final이 누락되었습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
추가해두었습니다. 감사합니다.