Skip to content

Commit

Permalink
[feat #184] bulk 연산 시 직접 update 필드를 변경하도록 벌크 쿼리 메서드 파라미터 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
dudxo committed Jan 12, 2025
1 parent f3871e1 commit 664b71d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.dnd.gongmuin.chat_inquiry.repository;

import java.time.LocalDateTime;
import java.util.List;

import org.springframework.data.domain.Pageable;
Expand All @@ -14,7 +15,7 @@ public interface ChatInquiryQueryRepository {

List<Long> getAutoRejectedInquirerIds();

void updateChatInquiryStatusRejected();
void updateChatInquiryStatusRejected(LocalDateTime now);

List<RejectedChatInquiryDto> getAutoRejectedChatInquiries();
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ public List<RejectedChatInquiryDto> getAutoRejectedChatInquiries() {
.fetch();
}

public void updateChatInquiryStatusRejected() {
public void updateChatInquiryStatusRejected(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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.dnd.gongmuin.chat_inquiry.service;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;

Expand Down Expand Up @@ -135,7 +136,7 @@ public RejectChatResponse rejectChat(Long chatInquiryId, Member answerer) {
public void rejectChatAuto() {
List<RejectedChatInquiryDto> rejectedChatInquiryDtos = chatInquiryRepository.getAutoRejectedChatInquiries();
List<Long> rejectedInquirerIds = getRejectedInquirerIds(rejectedChatInquiryDtos);
chatInquiryRepository.updateChatInquiryStatusRejected();
chatInquiryRepository.updateChatInquiryStatusRejected(LocalDateTime.now());
memberRepository.refundInMemberIds(rejectedInquirerIds, CHAT_REWARD);
creditHistoryService.saveCreditHistoryInMemberIds(
rejectedInquirerIds, CreditType.CHAT_REFUND, CHAT_REWARD
Expand Down

0 comments on commit 664b71d

Please sign in to comment.