-
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 #193] 채팅 요청 상태 업데이트 함수 수정 #194
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6722173
[rename] : DTO 이름 변경
hyun2371 a0cd8b5
[refactor] : 만료된 채팅 요청 아이디를 비교해 상태 변경하도록 수정
hyun2371 72ef428
[test] : 아이디를 비교해 상태 변경하도록 수정 -> 테스트 반영
hyun2371 14a49ff
[refactor] : 스케줄러 함수명 변경
hyun2371 5c07326
[feat] : 만료된 채팅 요청 아이디로 벌크 연산 호출
hyun2371 e79b668
[test] : 만료된 채팅 요청 아이디로 벌크 연산 -> 테스트 반영
hyun2371 dbb9e4f
[refactor] : 로직 변경으로 불필요해진 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,9 @@ | |
|
||
import com.dnd.gongmuin.chat_inquiry.domain.InquiryStatus; | ||
import com.dnd.gongmuin.chat_inquiry.dto.ChatInquiryResponse; | ||
import com.dnd.gongmuin.chat_inquiry.dto.ExpiredChatInquiryDto; | ||
import com.dnd.gongmuin.chat_inquiry.dto.QChatInquiryResponse; | ||
import com.dnd.gongmuin.chat_inquiry.dto.QRejectedChatInquiryDto; | ||
import com.dnd.gongmuin.chat_inquiry.dto.RejectedChatInquiryDto; | ||
import com.dnd.gongmuin.chat_inquiry.dto.QExpiredChatInquiryDto; | ||
import com.dnd.gongmuin.member.domain.Member; | ||
import com.querydsl.core.types.dsl.CaseBuilder; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
|
@@ -44,21 +44,9 @@ public Slice<ChatInquiryResponse> getChatInquiresByMember(Member member, Pageabl | |
boolean hasNext = hasNext(pageable.getPageSize(), content); | ||
return new SliceImpl<>(content, pageable, hasNext); | ||
} | ||
|
||
public List<Long> getAutoRejectedInquirerIds() { | ||
return queryFactory | ||
.select(chatInquiry.inquirer.id) | ||
.from(chatInquiry) | ||
.where( | ||
chatInquiry.createdAt.loe(LocalDateTime.now().minusWeeks(1)), | ||
chatInquiry.status.eq(InquiryStatus.PENDING) | ||
) | ||
.fetch(); | ||
} | ||
|
||
public List<RejectedChatInquiryDto> getAutoRejectedChatInquiries() { | ||
public List<ExpiredChatInquiryDto> getExpiredChatInquires() { | ||
return queryFactory | ||
.select(new QRejectedChatInquiryDto( | ||
.select(new QExpiredChatInquiryDto( | ||
chatInquiry | ||
)) | ||
.from(chatInquiry) | ||
|
@@ -69,13 +57,12 @@ public List<RejectedChatInquiryDto> getAutoRejectedChatInquiries() { | |
.fetch(); | ||
} | ||
|
||
public void updateChatInquiryStatusRejected(LocalDateTime now) { | ||
public void updateChatInquiryStatusRejected(List<Long> expiredChatInquiryIds, LocalDateTime now) { | ||
queryFactory.update(chatInquiry) | ||
.set(chatInquiry.status, InquiryStatus.REJECTED) | ||
.set(chatInquiry.updatedAt, now) | ||
.where( | ||
chatInquiry.createdAt.loe(LocalDateTime.now().minusWeeks(1)), | ||
chatInquiry.status.eq(InquiryStatus.PENDING) | ||
chatInquiry.id.in(expiredChatInquiryIds) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 조건절을 개선해서 속도가 더욱 빨라지겠네요 👍 |
||
) | ||
.execute(); | ||
} | ||
|
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.
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.
더 정확한 네이밍이네요!