Skip to content

Commit

Permalink
[feat #184] 답변 미작성 게시글 환불 벌크 연산 시 업데이트 시각 직접 변경하도록 파라미터 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
dudxo committed Jan 12, 2025
1 parent 18d75bf commit 377c819
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.question_post.repository;

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

import org.springframework.data.domain.Pageable;
Expand All @@ -23,5 +24,5 @@ Slice<RecQuestionPostResponse> getRecommendQuestionPosts(

List<RefundQuestionPostDto> getRefundQuestionPostDtos();

void updateQuestionPostStatusAnswerClosed();
void updateQuestionPostStatusAnswerClosed(LocalDateTime now);
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ public List<RefundQuestionPostDto> getRefundQuestionPostDtos() {
}

@Override
public void updateQuestionPostStatusAnswerClosed() {
public void updateQuestionPostStatusAnswerClosed(LocalDateTime now) {
queryFactory
.update(questionPost)
.set(questionPost.status, QuestionPostStatus.ANSWER_CLOSED)
.set(questionPost.updatedAt, now)
.where(
questionPost.createdAt.loe(LocalDateTime.now().minusWeeks(2)),
questionPost.status.eq(QuestionPostStatus.ANSWER_WAITING)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.dnd.gongmuin.question_post.service;

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

import org.springframework.data.domain.Pageable;
Expand Down Expand Up @@ -150,7 +151,7 @@ private int getCountByType(Long questionPostId, InteractionType type) {
@Transactional
public void changeQuestionPostStatusAnswerClosed() {
refundQuestionPostCredit();
questionPostRepository.updateQuestionPostStatusAnswerClosed();
questionPostRepository.updateQuestionPostStatusAnswerClosed(LocalDateTime.now());
}

private void refundQuestionPostCredit() {
Expand Down

0 comments on commit 377c819

Please sign in to comment.