-
Notifications
You must be signed in to change notification settings - Fork 0
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
[refactor#148] 답변 채택 API 성능 최적화 #155
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a9c2c43
[test] : 채택 시 크레딧 정합성 테스트
dudxo af9e50c
[feat] : QuestionPostSimpleQueryRepo 생성
dudxo e47ae40
[feat] : AnswerSimpleQueryRepo 생성
dudxo c710df3
[feat] : 답변채택 쿼리 개수 개선 v2 추가
dudxo 9d4b53b
[feat] : 답변채택 쿼리 개수 개선 v2 API 추가
dudxo ee91d72
[test] : 답변채택 쿼리 개수 개선 v2 단위테스트 추가
dudxo 18b9c6e
[test] : 답변채택 쿼리 개수 개선 v2 통합테스트 추가
dudxo e08aedf
[Refactor #151] JWT Subject 개인정보 제거 (#154)
dudxo e145d22
[refactor #156] 채팅 요청 목록 API에서 채팅 파트너 조회 로직 리팩토링 (#157)
hyun2371 ca844e8
[refactor] : V1, V2 통합
dudxo 97f30ef
[test] : V1, V2 통합에 따른 테스트 코드 삭제
dudxo 26bfa04
[feat #158] 채팅 요청 상세 조회 API (#159)
hyun2371 9463711
[test] : V1, V2 통합에 따른 테스트 코드 수정
dudxo 49f801e
[feat] : QuestionPost 단건조회 메서드 추가
dudxo 4c52777
Merge branch 'refacotr/#148/mypage-optimization' of https://github.co…
hyun2371 ba52924
[test]: 정합성 테스트 disabled 처리
hyun2371 8086fe9
[refactor]: fetch join 함수 repository로 이동
hyun2371 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
2 changes: 1 addition & 1 deletion
2
src/main/java/com/dnd/gongmuin/answer/dto/AnswerDetailResponse.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
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
28 changes: 28 additions & 0 deletions
28
src/main/java/com/dnd/gongmuin/answer/repository/AnswerSimpleQueryRepository.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,28 @@ | ||
package com.dnd.gongmuin.answer.repository; | ||
|
||
import java.util.Optional; | ||
|
||
import org.springframework.stereotype.Repository; | ||
|
||
import com.dnd.gongmuin.answer.domain.Answer; | ||
|
||
import jakarta.persistence.EntityManager; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class AnswerSimpleQueryRepository { | ||
|
||
private final EntityManager em; | ||
|
||
public Optional<Answer> findAnswerById(Long answerId) { | ||
Answer answer = em.createQuery( | ||
"select a from Answer a" + | ||
" join fetch a.member m" + | ||
" where a.id = :answerId", Answer.class | ||
) | ||
.setParameter("answerId", answerId) | ||
.getSingleResult(); | ||
return Optional.of(answer); | ||
} | ||
} |
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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/dnd/gongmuin/chat_inquiry/dto/ChatInquiryDetailResponse.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,12 @@ | ||
package com.dnd.gongmuin.chat_inquiry.dto; | ||
|
||
import com.dnd.gongmuin.member.dto.response.MemberInfo; | ||
|
||
public record ChatInquiryDetailResponse( | ||
Long chatInquiryId, | ||
String inquiryMessage, | ||
String inquiryStatus, | ||
boolean isInquirer, | ||
MemberInfo chatPartner | ||
) { | ||
} |
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
43 changes: 22 additions & 21 deletions
43
src/main/java/com/dnd/gongmuin/chat_inquiry/dto/ChatInquiryResponse.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,39 +1,40 @@ | ||
package com.dnd.gongmuin.chat_inquiry.dto; | ||
|
||
import com.dnd.gongmuin.chat_inquiry.domain.InquiryStatus; | ||
import com.dnd.gongmuin.member.domain.JobGroup; | ||
import com.dnd.gongmuin.question_post.dto.response.MemberInfo; | ||
import com.dnd.gongmuin.chat_inquiry.domain.ChatInquiry; | ||
import com.dnd.gongmuin.member.domain.Member; | ||
import com.dnd.gongmuin.member.dto.response.MemberInfo; | ||
import com.querydsl.core.annotations.QueryProjection; | ||
|
||
public record ChatInquiryResponse( | ||
Long chatInquiryId, | ||
String inquiryMessage, | ||
String inquiryStatus, | ||
boolean isInquirer, | ||
MemberInfo chatPartner | ||
MemberInfo chatPartner, | ||
String createdAt | ||
) { | ||
@QueryProjection | ||
public ChatInquiryResponse( | ||
Long chatInquiryId, | ||
String inquiryMessage, | ||
InquiryStatus inquiryStatus, | ||
boolean isInquirer, | ||
Long partnerId, | ||
String partnerNickname, | ||
JobGroup partnerJobGroup, | ||
int partnerProfileImageNo | ||
ChatInquiry chatInquiry, | ||
boolean isInquirer | ||
) { | ||
this( | ||
chatInquiryId, | ||
inquiryMessage, | ||
inquiryStatus.getLabel(), | ||
chatInquiry.getId(), | ||
chatInquiry.getMessage(), | ||
chatInquiry.getStatus().getLabel(), | ||
isInquirer, | ||
new MemberInfo( | ||
partnerId, | ||
partnerNickname, | ||
partnerJobGroup.getLabel(), | ||
partnerProfileImageNo | ||
) | ||
createPartnerInfo(isInquirer, chatInquiry), | ||
chatInquiry.getCreatedAt().toString() | ||
); | ||
} | ||
|
||
private static MemberInfo createPartnerInfo(boolean isInquirer, ChatInquiry chatInquiry) { | ||
Member partner = isInquirer ? chatInquiry.getAnswerer() : chatInquiry.getInquirer(); | ||
return new MemberInfo( | ||
partner.getId(), | ||
partner.getNickname(), | ||
partner.getJobGroup().getLabel(), | ||
partner.getProfileImageNo() | ||
); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/main/java/com/dnd/gongmuin/chat_inquiry/dto/CreateChatInquiryResponse.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
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.
수정 감사합니다~